[STM32F401CE] debugging a new board definition [solved]
Re: [STM32F401CE] debugging a new board definition
I'd get your code working with the internal oscillator and get your blinky blinking at the right rate. Then get a UART working, and then you should be able to switch to the external oscillator and get blinky/UART REPL/USB REPL working.
When stuff goes south, then I also like to back down to something really simple, which is why I created this little repository:
https://github.com/dhylands/stm32-test
Or create your own little project using something like the NUCLEO-F401RE. Get it working on there and verify the blink rate. Then get it working on your board. If you start using HSI, you should even be able to arrange things to use the identical firmware between the NUCLEO board and your board.
When stuff goes south, then I also like to back down to something really simple, which is why I created this little repository:
https://github.com/dhylands/stm32-test
Or create your own little project using something like the NUCLEO-F401RE. Get it working on there and verify the blink rate. Then get it working on your board. If you start using HSI, you should even be able to arrange things to use the identical firmware between the NUCLEO board and your board.
Re: [STM32F401CE] debugging a new board definition
I just fixed that and make clean and make again and no change.
In
if [ "$1" == "--clean" ]
$1 needed quotes around it.
I'm thinking of making a version of my "simple" boot.py and pintest.py and load them into a G30TH
as sanity check now...
Code: Select all
#!/bin/bash
# make_with_frozen_PYFLEX_F401.sh
echo Building for $BOARD
export FROZEN_DIR="/home/john/Documents/EEProjects/circuitboards/culture_shock/code_PYFLEX_F401/frozen"
if [ $BOARD ]
then
cd /home/john/micropython/ports/stm32
if [ "$1" == "--clean" ]
then
make BOARD=$BOARD clean
exit
fi
if make -j 2 BOARD=$BOARD FROZEN_MPY_DIR=$FROZEN_DIR
then
sleep 1
make BOARD=$BOARD deploy-stlink
cd -
# sleep 1
# rshell
else
echo Build failure
fi
else
echo "Wrong board type."
fi
if [ "$1" == "--clean" ]
$1 needed quotes around it.
I'm thinking of making a version of my "simple" boot.py and pintest.py and load them into a G30TH
as sanity check now...
John Griessen blog.kitmatic.com
Re: [STM32F401CE] debugging a new board definition
Thanks, I'll start working with the nucleo-f401re. The G30TH is a different MCU after all.. I'll need to figure which pins to attach my leads with pin connectors to on the nucleo-f401re. My nucleo-f401re is separated from its STLINK by removing zero ohm R's on back, and only have one nucleo-f401re.I'd get your code working with the internal oscillator and get your blinky blinking at the right rate. Then get a UART working, and then you should be able to switch to the external oscillator and get blinky/UART REPL/USB REPL working.
When stuff goes south, then I also like to back down to something really simple, which is why I created this little repository:
https://github.com/dhylands/stm32-test
Maybe I could leave the wires connected to the new F401 platform and use my nucleo-f401re by its USB port... mm.... nope,
the nucleo uses the stlink USB port and translates to serial port to function.
Last edited by jgriessen on Thu Apr 05, 2018 6:21 pm, edited 1 time in total.
John Griessen blog.kitmatic.com
Re: [STM32F401CE] debugging a new board definition
Should VSS and VDD be left off of pins.csv?
NUCLEO_F401RE platform pins.csv leaves them and even NRST out.
NUCLEO_F401RE platform mpconfigboard.h:
#define MICROPY_HW_UART2_TX (pin_A2)
#define MICROPY_HW_UART2_RX (pin_A3)
syntax copied from G30TH platform mpconfigboard.h:
// UART config
#define MICROPY_HW_UART2_PORT (GPIOA)
#define MICROPY_HW_UART2_PINS (GPIO_PIN_2 | GPIO_PIN_3)
#define MICROPY_HW_UART2_RTS (GPIO_PIN_1)
#define MICROPY_HW_UART2_CTS (GPIO_PIN_0)
The top way is newer, correct? (I'm using 1.9.3 micropython)
NUCLEO_F401RE platform pins.csv leaves them and even NRST out.
NUCLEO_F401RE platform mpconfigboard.h:
#define MICROPY_HW_UART2_TX (pin_A2)
#define MICROPY_HW_UART2_RX (pin_A3)
syntax copied from G30TH platform mpconfigboard.h:
// UART config
#define MICROPY_HW_UART2_PORT (GPIOA)
#define MICROPY_HW_UART2_PINS (GPIO_PIN_2 | GPIO_PIN_3)
#define MICROPY_HW_UART2_RTS (GPIO_PIN_1)
#define MICROPY_HW_UART2_CTS (GPIO_PIN_0)
The top way is newer, correct? (I'm using 1.9.3 micropython)
John Griessen blog.kitmatic.com
Re: [STM32F401CE] debugging a new board definition
The G30TH board probably needs to be updated. Thanks for pointing that out.
Pins like VSS and VDD or any other pin which the MCU can't otherwise manipulate don't need to go in pins.csv.
Having said that, it's also fine to leave them in pins.csv as a form of documentation. The code will ignore them since they don't serve any recognized function.
Pins like VSS and VDD or any other pin which the MCU can't otherwise manipulate don't need to go in pins.csv.
Having said that, it's also fine to leave them in pins.csv as a form of documentation. The code will ignore them since they don't serve any recognized function.
Re: [STM32F401CE] debugging a new board definition
I connected the back side solder balls for TX and RX again, and jumpered the stlink to the nucleo-f401re and ran my make_with_frozen_NUCLEO_F401RE.sh script and it says loaded and verified, and then no REPL.
I get a /dev/ttyACM0 and rshell can't talk to it.
screen /dev/ttyACM0 results in 30 or so chars of random, then the terminal emulator tab is messed up, killing screen doesnt fix it and have to use another terminal window. Seems like a wrong speed for serial port. Digging into that.
I also see a USB generated popup window for a virtual fiesystem with mbed.htm and details.txt in it.
Looking at docs for using stlink as serial port converter they are too slim, so I am going to use my FT2232H next
for serial port REPL attempt. My nucleo-f401re stlink part might be broken.
I get a /dev/ttyACM0 and rshell can't talk to it.
screen /dev/ttyACM0 results in 30 or so chars of random, then the terminal emulator tab is messed up, killing screen doesnt fix it and have to use another terminal window. Seems like a wrong speed for serial port. Digging into that.
I also see a USB generated popup window for a virtual fiesystem with mbed.htm and details.txt in it.
Looking at docs for using stlink as serial port converter they are too slim, so I am going to use my FT2232H next
for serial port REPL attempt. My nucleo-f401re stlink part might be broken.
Code: Select all
#!/bin/bash
# make_with_frozen_NUCLEO_F401RE.sh
export BOARD="NUCLEO_F401RE"
echo Building for $BOARD
export FROZEN_DIR="/home/john/Documents/EEProjects/circuitboards/culture_shock/code_NUCLEO_F401RE/frozen"
if [ $BOARD ]
then
cd /home/john/micropython/ports/stm32
if [ "$1" == "--clean" ]
then
make BOARD=$BOARD clean
exit
fi
if make -j 2 BOARD=$BOARD FROZEN_MPY_DIR=$FROZEN_DIR
then
sleep 1
make BOARD=$BOARD deploy-stlink
cd -
# sleep 1
# rshell
else
echo Build failure
fi
else
echo "Wrong board type."
fi
John Griessen blog.kitmatic.com
Re: [STM32F401CE] debugging a new board definition
That popup filesystem is for the stlink programmer and not a filesystem for the STM32F401.
I tried the latest master using BOARD=NUCLEO_F401RE and I get a REPL on the serial port (at 115200 baud) presented by the stlink interface.
I tried the latest master using BOARD=NUCLEO_F401RE and I get a REPL on the serial port (at 115200 baud) presented by the stlink interface.
Code: Select all
MicroPython v1.9.3-521-gd6cf5c6 on 2018-04-05; NUCLEO-F401RE with STM32F401xE
Type "help()" for more information.
>>>
Re: [STM32F401CE] debugging a new board definition
I made the following changes to get the NUCLEO image to run on the HSI:
https://github.com/dhylands/micropython ... e9f5fe417b
I removed SB16 to ensure that the 8MHz signal from the stlink side wasn't driving the HSE, and the serial REPL still works at 115200.
https://github.com/dhylands/micropython ... e9f5fe417b
I removed SB16 to ensure that the 8MHz signal from the stlink side wasn't driving the HSE, and the serial REPL still works at 115200.
Re: [STM32F401CE] debugging a new board definition
Thanks for those tests, Dave. I'll try my FT2232H for reading the serial port of my nucleo-f041re
John Griessen blog.kitmatic.com
Re: [STM32F401CE] debugging a new board definition
Moving this from "alt function pins, small packages with fewer pins, pins.csv"
general discussion forum since it is now about a new platform and debugging it.
the compile ends with a warning
C build-PYFLEX_F401/pins_PYFLEX_F401.c
CC build-PYFLEX_F401/frozen_mpy.c
LINK build-PYFLEX_F401/firmware.elf
arm-none-eabi-ld: warning: cannot find entry symbol _start; defaulting to 00008000
text data bss dec hex filename
0 0 0 0 0 build-PYFLEX_F401/firmware.elf
I get firmware.bin -- not two files, not big enough.
ll build-PYFLEX_F401/fir*
-rwxr-xr-x 1 john john 0 Apr 10 16:39 build-PYFLEX_F401/firmware.bin
-rw-r--r-- 1 john john 309 Apr 10 16:39 build-PYFLEX_F401/firmware.dfu
-rwxr-xr-x 1 john john 1104 Apr 10 16:39 build-PYFLEX_F401/firmware.elf
general discussion forum since it is now about a new platform and debugging it.
the compile ends with a warning
C build-PYFLEX_F401/pins_PYFLEX_F401.c
CC build-PYFLEX_F401/frozen_mpy.c
LINK build-PYFLEX_F401/firmware.elf
arm-none-eabi-ld: warning: cannot find entry symbol _start; defaulting to 00008000
text data bss dec hex filename
0 0 0 0 0 build-PYFLEX_F401/firmware.elf
I get firmware.bin -- not two files, not big enough.
ll build-PYFLEX_F401/fir*
-rwxr-xr-x 1 john john 0 Apr 10 16:39 build-PYFLEX_F401/firmware.bin
-rw-r--r-- 1 john john 309 Apr 10 16:39 build-PYFLEX_F401/firmware.dfu
-rwxr-xr-x 1 john john 1104 Apr 10 16:39 build-PYFLEX_F401/firmware.elf
John Griessen blog.kitmatic.com