florisla / stm32loader

Flash firmware to STM32 microcontrollers using Python.
GNU General Public License v3.0
109 stars 53 forks source link

Using stm32loader with Jetson Nano #55

Closed andriskuciks closed 3 years ago

andriskuciks commented 3 years ago

Hello!

I was wondering have anyone tried this FW uploading tool on Jetson Nano? I installed stm32loader via pip3 since it supports python3.4 to 3.8 but it seems like there is an architecture issue because when using stm32loader -h in terminal it can't find the executable file. Is it possible to use this tool on embedded Linux? Or maybe someone has managed to achieve this already on Jetson with another tool? I'm using STM32F302VC microcontroller. Another problem probably is that the MCU isn't connected over USB cable but with custom made connector. Connector has all necessary pin connections (USART2 TX/RX, BOOT0, RST pin). Note: STM32Programmer and other default STM tools doesn't support Jetson architecture.

BR, Andris

florisla commented 3 years ago

Stm32loader definitely works fine under Linux, embedded or otherwise.

This looks more like an installation issue rather than an architecture issue.

If pip3works, try this:

python3 -m stm32loader -h

What is the port (-p option) you are using?

andriskuciks commented 3 years ago

Thanks for help, this python3 -m stm32loader -h works.

Well since STM32 USART2 is connected to Jetson Nano UART2 for the -p argument I'm using port /dev/ttyTHS1.

I still can't manage to flash the firmware. stm32loader prints: Activating bootloader (select UART) Bootloader activation timeout -- retrying Can't init into bootloader. Ensure that BOOT0 is enabled and reset the device.

Full command I'm trying to run: sudo python3 -m stm32loader -p /dev/ttyTHS12 -e -q firmware.elf.

Tried it on second (THS1) port and got the same output.

According to STM32F302VC datasheet it should be possible to program MCU via USART2 in bootloader mode so that shouldn't be the problem

EDIT: I went thru the code of main.py and saw that stm32loader tries to reset MCU and if it fails then prints out the above mentioned messages. I think that the issue is that stm32loader isn't able to reset the device because its not a default connection. Is it possible to define these pins? Other solution might be to manually put device in bootloader mode and use stm32loader to erase and write new FW. Is it possible to skip setting MCU in bootloader mode with current code? I tried to put manually STM32 in bootloader mode and then use the same command to program MCU but got the same output Forgot to add pin connections, BOOT0 - pin 13 on Jetson header (gpio14); RST - pin 7 (gpio216); USART2_RX(stm32) - pin 8 (UART_2_TX); USART2_TX - pin 10 (UART_2_RX)

andriskuciks commented 3 years ago

Hello again. Today I got my hands on digital analyzer and it turns out that the problem was in my HW setup. Just managed to erase chip memory. Now gonna continue on programming MCU! Thank you for the tool @florisla ! BR, Andris

florisla commented 3 years ago

Thanks for the update. Good luck, erasing is just the start ;-)

Oh, and credit goes to @jsnyder who developed stm32loader to begin with.