Page 1 of 1

[STM32F401CE] debugging a new platform with SWD or USART (USB not working )

Posted: Tue Apr 03, 2018 6:22 pm
by jgriessen
I have my new platform running enough that I can use SWD pins, openocd program to load code. After reset, run again,
I can put this board into DFU mode and see it via a lsusb so some of its USB pins are working. It does not start up a virtual USB drive though, so something is wrong.

What is a good way to load some test programs in micropython without the USB port? I am not thinking loading some straight C program would tell much more than DFU mode already working, and openocd able to laod and verify code via SWD pins.
I'd like to give it this to run:
pyb.repl_uart(pyb.UART(1, 9600)) # duplicate REPL on UART(1)

But, now I found this from https://www.carminenoviello.com/2015/06 ... nucleo-f4/
// UART config
#define MICROPY_HW_UART2_PORT (GPIOA)
#define MICROPY_HW_UART2_PINS (GPIO_PIN_2 | GPIO_PIN_3)
#define MICROPY_HW_UART6_PORT (GPIOC)
#define MICROPY_HW_UART6_PINS (GPIO_PIN_6 | GPIO_PIN_7)

#define MICROPY_HW_UART_REPL PYB_UART_2
#define MICROPY_HW_UART_REPL_BAUD 115200

The above uses some old terminology, so not ready to go as is, but if I can figure it out, it loads all in one blob of code, then boots,
so it fits what I need before getting USB to work...

What is the proper way to do the above defines for 1.9.3 micropython?

Re: [STM32F401CE] debugging a new platform with SWD or USART (USB not working )

Posted: Tue Apr 03, 2018 8:57 pm
by dhylands
If you can get a REPL then you should be able to use rshell to copy files into your onboard file system. Since Control-C doesn't work on a serial REPL, you'll want to make sure that you boot to the REPL. You'll also need to use the --buffer-size=32 option.

The other way would be to use frozen modules which are compiled into the firmware.