![]() |
px-fwlib 0.10.0
Cross-platform embedded library and documentation for 8/16/32-bit microcontrollers generated with Doxygen 1.9.2
|
With it's massive community and extensive set of supported boards and libraries, the Arduino development environment has become a force of nature. Here are the steps to set up and use the Arduino IDE for the PX-HER0 board.
Go to THIS page to download and install Arduino 1.8.10 or newer.
Support for STM32 boards are provided HERE.
Open the Preferences dialog in the Arduino IDE:
File > Preferences Ctrl+Comma
Add a link to the stm32duino JSON file in the "Additional Boards Manager URLs" field:
https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
More than one link (URL) can be added by using the button next to the text field.
Now open the Boards Manager window in the Arduino IDE:
Tools > Board: "xxx" > Boards Manager...
Type "STM32" into the search bar to narrow down the list of packages and install the "STM32 MCU based boards by STMicroelectronics" package.
Select the PX-HER0 board from the list of supported boards:
Tools > Board: "xxx" > STM32 boards groups > Generic STM32L0 series Tools > Board part number: "xxx" > PX-HERO
Options can be specified for the PX-HER0 board in sub menus:
Select "CDC (generic 'Serial supersede U(S)ART)" as the USB interface. This will configure the Arduino firmware to stream all Serial communication over USB. We will use the USB1 connector on the PX-HER0 board for serial communication.
Select "STM32CubeProgrammer (DFU)" as the upload method. The Arduino IDE will use the STM32CubeProgrammer command line software to program the STM32 via it's bootloader in ROM. We will use the USB1 connector on the PX-HER0 board to program the STM32 too.
Open the "serial_hello_world" sketch. It is located here:
px-fwlib/boards/arm/stm32/px_hero/arduino/examples/serial_hello_world/serial_hello_world.ino
Build the sketch:
Sketch > Verify/Compile Ctrl+R
Connect the BOOT jumper on the PX-HER0 board. It will pull the BOOT0 pin of the STM32 low and the built-in bootloader will be activated upon reset or power up.
Press the RST button. This will activate the bootloader.
Upload the sketch:
Sketch > Upload Ctrl+U
After the sketch has been uploaded, the program will imediately start to run.
Open Tera Term and connect to the virtual serial port created the PX-HER0 board. The program will wait for the PC to connect and then start to send the string "Hello World!" once a second:
Success!!
You can keep the BOOT jumper connected while developing. When you want to upload a new sketch, tap the RST button and the STM32 will go back into boot mode, ready to receive a new program.
remove the BOOT jumper when you are finished. Otherwise, the STM32 will appear "dead", because it is in boot mode and not executing your program.
The PX-HER0 board pins are mapped in THIS file. It is duplicated here for easy offline viewing:
px-fwlib/boards/arm/stm32/px_hero/arduino/variants/STM32L0xx/L072R(B-Z)T_L073R(B-Z)T_L083R(B-Z)T/variant_PX_HER0.h
Here is the map table:
Digital pin | Alias 1 | Alias 2 |
---|---|---|
0 | PA6 | PX_GPIO0 |
1 | PA5 | PX_GPIO1 |
2 | PA1 | PX_GPIO2 |
3 | PA0 | PX_GPIO3 |
4 | PC3 | PX_GPIO4 |
5 | PC2 | PX_GPIO5 |
6 | PC1 | PX_GPIO6 |
7 | PB7 | PX_GPIO7 |
8 | PH0 | PX_USR_LED |
9 | PC0 | PX_LCD_BTN_1_LT |
10 | PH1 | PX_LCD_BTN_2_RT |
11 | PC13 | PX_LCD_BTN_3_UP |
12 | PC12 | PX_LCD_BTN_4_DN |
13 | PA15 | PX_LCD_BTN_5_YES |
14 | PC9 | PX_LCD_BTN_6_NO |
15 | PA8 | PX_USB_DET |
16 | PB11 | PX_LCD_RS |
17 | PB12 | PX_LCD_BACKLIGHT |
18 | PC6 | PX_PWM_BUZZER |
19 | PC7 | PX_VBAT_MEAS_EN |
20 | PC8 | PX_PWR_HOLD |
21 | PA9 | PX_UART1_TX |
22 | PA10 | PX_UART1_RX |
23 | PA2 | PX_UART2_TX |
24 | PA3 | PX_UART2_RX |
25 | PC10 | PX_UART4_TX |
26 | PC11 | PX_UART4_RX |
27 | PB8 | PX_I2C1_SCL |
28 | PB9 | PX_I2C1_SDA |
29 | PB6 | PX_SPI1_CS |
30 | PB3 | PX_SPI1_SCK |
31 | PB5 | PX_SPI1_MOSI |
32 | PB4 | PX_SPI1_MISO |
33 | PB2 | PX_SPI2_CS_SF |
34 | PB10 | PX_SPI2_CS_LCD |
35 | PD2 | PX_SPI2_CS_SD |
36 | PB13 | PX_SPI2_SCK |
37 | PB15 | PX_SPI2_MOSI |
38 | PB14 | PX_SPI2_MISO |
39 | PA4 | PX_DAC1 |
40 | PB0 | PX_ADC0 |
41 | PC5 | PX_ADC1 |
42 | PC4 | PX_ADC2 |
43 | PA7 | PX_ADC3 |
44 | PB1 | PX_ADC_VBAT |
Thus the following code lines are all equivalent:
Several examples are provided to demonstrate different parts of the board. Click HERE to proceed...