MCUDev Black STM32F407VET6 + STM32F407ZET6 dev boards
Re: Black STM32F407VET6 + STM32F407ZET6 dev boards
I am also a newbie with micropython and this VET6 board. I have installed micropython on this and a couple of ESP boards. I also have a question regarding using the sdcard on the board. I have seen in the mbed forum (https://os.mbed.com/users/hudakz/code/S ... /shortlog/) a posting on using the sdcard by connecting some of the pins together and running a c program. One of the reasons I am drawn to micropython for this board is to avoid using the mbed environment and I must admit I have had no success with using an ST-link (under linux) to program even the examples.
The procedure for installing and running micropython by mcauser was flawless and I have been blinking the leds happily and tried the spiflash example also. But of course I want more! I am not sure of the status of using the sdcard but it would make for a real project by logging data.
If someone can provide an example code or otherwise illuminate my understanding that would be much appreciated.
Thanks
Larry
The procedure for installing and running micropython by mcauser was flawless and I have been blinking the leds happily and tried the spiflash example also. But of course I want more! I am not sure of the status of using the sdcard but it would make for a real project by logging data.
If someone can provide an example code or otherwise illuminate my understanding that would be much appreciated.
Thanks
Larry
- JohnLittle
- Posts: 11
- Joined: Mon Oct 08, 2018 7:10 pm
Re: Black STM32F407VET6 + STM32F407ZET6 dev boards
Hey @okwatts, just got the sdcard working I think.
I modified ports/stm32/sdcard.c as per @lmamakos's instructions viewtopic.php?f=12&t=3086#p18286
and
I then enabled sdcard support in micropython-1.11/ports/stm32/boards/BLACK_F407VE/mpconfigboard.h
(Not sure if the second line is needed... spur of the moment!)
Anything else stays commented as it was, especially the following:
After I followed @mcauser's instructions for building and deploying, I had a running system: https://github.com/mcauser/BLACK_F407VE
cd micropython-1.11/ports/stm32
make BOARD=BLACK_F407VE
make BOARD=BLACK_F407VE deploy
I formatted a 2GB sdcard in FAT32 and gave it the volume name "BLACK_F407VE". Then after a reset with the sdcard in, that's the name I see mounted as a drive (/dev/sdc1).
Also, main.py on the sdcard is launched when the board is powered.
And if the card is removed and the board reset, the original content on the flash memory becomes visible (and executed) instead.
Hope this helps
Cheers,
John
I modified ports/stm32/sdcard.c as per @lmamakos's instructions viewtopic.php?f=12&t=3086#p18286
Code: Select all
// configure the SD card detect pin
// we do this here so we can detect if the SD card is inserted before powering it on
#if defined(MICROPY_HW_SDCARD_DETECT_PRESENT)
mp_hal_pin_config(MICROPY_HW_SDCARD_DETECT_PIN, MP_HAL_PIN_MODE_INPUT, MICROPY_HW_SDCARD_DETECT_PULL, 0);
#endif
Code: Select all
bool sdcard_is_present(void) {
#if MICROPY_HW_ENABLE_MMCARD
if (pyb_sdmmc_flags & PYB_SDMMC_FLAG_MMC) {
return false;
}
#endif
#if defined(MICROPY_HW_SDCARD_DETECT_PRESENT)
return HAL_GPIO_ReadPin(MICROPY_HW_SDCARD_DETECT_PIN->gpio, MICROPY_HW_SDCARD_DETECT_PIN->pin_mask) == MICROPY_HW_SDCARD_DETECT_PRESENT;
#else
return true;
#endif
}
Code: Select all
#define MICROPY_HW_ENABLE_SDCARD (1) // it has a sd scard, but i am not sure what the detect pin is, yet
#define MICROPY_HW_SDCARD_MOUNT_AT_BOOT (1)
Anything else stays commented as it was, especially the following:
Code: Select all
// SD card detect switch
// #define MICROPY_HW_SDCARD_DETECT_PIN (pin_A8) // nope
// #define MICROPY_HW_SDCARD_DETECT_PULL (GPIO_PULLUP)
// #define MICROPY_HW_SDCARD_DETECT_PRESENT (GPIO_PIN_RESET)
cd micropython-1.11/ports/stm32
make BOARD=BLACK_F407VE
make BOARD=BLACK_F407VE deploy
I formatted a 2GB sdcard in FAT32 and gave it the volume name "BLACK_F407VE". Then after a reset with the sdcard in, that's the name I see mounted as a drive (/dev/sdc1).
Code: Select all
jl@kitkat:~/projects/micropython-1.11/ports/stm32/boards/BLACK_F407VE$ df
Filesystem 1K-blocks Used Available Use% Mounted on
[...]
/dev/sdc1 1938724 8 1938716 1% /media/jl/BLACK_F407V
And if the card is removed and the board reset, the original content on the flash memory becomes visible (and executed) instead.
Hope this helps
Cheers,
John
Re: Black STM32F407VET6 + STM32F407ZET6 dev boards
I followed your detailed instructions and the work of mcauser and it works just as you described. I can now happily read either flash or sdcard.
Thanks John for the instructions and to all who contributed to the development of micropython particularly for the STM32.
Now to put it to use in logging some data.
Thanks John for the instructions and to all who contributed to the development of micropython particularly for the STM32.
Now to put it to use in logging some data.
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: Black STM32F407VET6 + STM32F407ZET6 dev boards
I am also trying to build for this board and altered the sdcard.c and cloned mcauser config then altered to enable the sdcard.
but my build is failing when it tried to build frozen module lcd160cr_test.py as it says mpy-cross: command not found
but my build is failing when it tried to build frozen module lcd160cr_test.py as it says mpy-cross: command not found
Re: Black STM32F407VET6 + STM32F407ZET6 dev boards
mpy-cross has to be built manually. It is not included any more in the standard build process.
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: Black STM32F407VET6 + STM32F407ZET6 dev boards
So how would one go about undertaking this process?
edit : ok I have found it
Last edited by OutoftheBOTS_ on Wed Jul 17, 2019 6:42 am, edited 1 time in total.
-
- Posts: 60
- Joined: Sun Jun 23, 2019 4:55 am
- Location: Gateshead, Tyne and Wear
Re: Black STM32F407VET6 + STM32F407ZET6 dev boards
Hello
Many thanks to JohnLittle for the code to get the SDCard working I have just put in place on my board with the latest version of MP.
Regards Mike
Many thanks to JohnLittle for the code to get the SDCard working I have just put in place on my board with the latest version of MP.
Regards Mike
Re: Black STM32F407VET6 + STM32F407ZET6 dev boards
See the main page (https://github.com/micropython/micropython). From the base MicroPython directory:
Code: Select all
$ cd mpy-cross
$ make
Last edited by rpr on Wed Jul 17, 2019 6:43 am, edited 1 time in total.
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: Black STM32F407VET6 + STM32F407ZET6 dev boards
yep found it just before you posted.rpr wrote: ↑Wed Jul 17, 2019 6:42 amSee the main page. From the base MicroPython directory:
Code: Select all
$ cd mpy-cross $ make
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: Black STM32F407VET6 + STM32F407ZET6 dev boards
Ok so now the build gets further but still fails.
Code: Select all
LINK build-MCUDEV_DEVEBOX_F407VGT6/firmware.elf
build-MCUDEV_DEVEBOX_F407VGT6/main.o: In function `stm32_main':
main.c:(.text.stm32_main+0x2d0): undefined reference to `_sstack'
build-MCUDEV_DEVEBOX_F407VGT6/stm32_it.o: In function `HardFault_C_Handler':
stm32_it.c:(.text.HardFault_C_Handler+0x13c): undefined reference to `_sstack'
build-MCUDEV_DEVEBOX_F407VGT6/modmachine.o: In function `machine_info':
modmachine.c:(.text.machine_info+0x1b8): undefined reference to `_sstack'
Makefile:537: recipe for target 'build-MCUDEV_DEVEBOX_F407VGT6/firmware.elf' failed
make: *** [build-MCUDEV_DEVEBOX_F407VGT6/firmware.elf] Error 1