Loading 3D model… large boards can take a moment.
PUYA projects is an experiment to use low-cost ARM PUYA microcontrollers.
Install GNU Arm Embedded Toolchain:
To add the environment variable we look in the windows bar: "Edit environment variables for your account".
&"C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\12.3 rel1\bin\arm-none-eabi-gcc" -v
If it has been installed correctly you should obtain a result similar to the following:
Install Make:
Check Make Installation:
make -v
Install SEGGER J-Link:
Clone the PY32 Examples Repository: Copy code
git clone https://github.com/TDLOGY/py32f0-template-project
Copy the JLinkDevices Directory: Copy [PY32 Directory]/Misc/Flash/JLinkDevices to C:\Users\[User]\AppData\Roaming\SEGGER\JLinkDevices\.
Find the JLink Path: Locate the path where JLink is installed, typically something like: "C:\Program Files\SEGGER\JLink\JLink". Save it for future configurations.
Connect J-Link and Verify: In Windows PowerShell, use the following command to verify the J-Link connection:
&"C:\Program Files\SEGGER\JLink\JLink"
Open Visual Studio Code:
py32f0-template-project folder.Adjust Makefile for Your Chip (The "Makerfile" is located in the project folder):
Compile the Project:
make -j4 in the Visual Studio Code (VSC) terminal and verify that it compiles correctly, otherwise, it could be that the "Makefile" has not been configured correctly.Modify the Code:
/User/main.c file.Compile Again: Execute make clean to clean the compilation and after make -j4 to compile with the changes made.
Program the Board: Use make flash to upload the code to your board using J-Link. (You must have your J-Link connected to your computer and with the corresponding connections to the development board)
Save Your Changes: Remember to save the modified files before compiling.
Clean Previous Compilation: If you make changes to the code, run make clean before compiling again.
PUYA Dev Board with the PY32F002AA15M6TU microcontroller should now be configured and ready to go!
The development board can be programmed via SWD by a J-Link (The J-link connections will depend on which J-Link and connector you are going to use).
SWD is a bidirectional communication protocol that allows for fast and efficient microcontroller debugging and programming.
SWD uses two signal lines, one for data (SWDIO) and one for clock (SWCLK), to communicate with the microcontroller. Through these lines, you can load programs into the microcontroller, stop code execution to inspect variables and debug errors, and perform other debugging operations. It is faster and more efficient than older debugging methods, such as JTAG.
As mentioned earlier, SWD communication involves two key lines: SWDIO for data and SWCLK for the clock signal. However, in addition to these two lines, we also require two more connections:
Note: You need to power up the PUYA Dev board with an external 5V power supply.
To program the PUYA Dev Board with the J-Link PLUS Compact we will need the following components:
|
USB Cable.
|
J-Link PLUS Compact.
|
Dupont Wires.
|
In addition to this, in order to make the connections we must know what the J-Link pinout is, take the image below as a reference and connect each wire from your PUYA Dev Board to the corresponding one on the J-Link:
To program the PUYA Dev Board with the J-Link EDU Mini we will need the following components:
|
USB Cable.
|
J-Link EDU Mini.
|
J-Link EDU Mini PCB Adapter.
|
J-Link EDU Mini Cable.
|
Dupont Wires.
|
As shown in the required material, the J-Link EDU Mini PCB Adapter helps us a lot in identifying where we need to connect each wire from our PUYA development board to the PCB adapter. After connecting the corresponding wires you can program your board.
The image above is just a reference image of the connections. The board is being powered directly with 5V and there are the following connections:
| PUYA Dev Board | J-Link Compact | J-Link EDU | Power Supply |
|---|---|---|---|
| 3.3V | VTref | Vref | X |
| GND | GND | GND | GND |
| DIO | SWDIO | SWIO | X |
| CLK | SWCLK | CLK | X |
| 5V | X | X | 5V |
This example is based on the Example Code PY32F0
No comments yet. Be the first to ask about this board.