stm32f4discovery

STM32F4 Discovery - Writing / Reading Flash memory

烈酒焚心 提交于 2019-12-02 03:04:46
This is my first post here, sorry if format or something is wrong. I succeed writing and reading flash memory of the STM32F4 Discovery following the advises of our colleges here and here (both posts explain the same way): __attribute__((__section__(".user_data"))) const char userConfig[64]; [...] void Write_Flash(uint8_t data) { HAL_FLASH_Unlock(); __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGSERR ); FLASH_Erase_Sector(FLASH_SECTOR_6, VOLTAGE_RANGE_3); HAL_FLASH_Program(TYPEPROGRAM_WORD, &userConfig[0], data); HAL_FLASH_Lock();

Allocating memory in Flash for user data (STM32F4 HAL)

有些话、适合烂在心里 提交于 2019-11-27 18:52:57
I'm trying to use the internal flash of an STM32F405 to store a bunch of user settable bytes that remain after rebooting. I'm using: uint8_t userConfig[64] __attribute__((at(0x0800C000))); to allocate memory for the data I want to store. When the program starts, I check to see if the first byte is set to 0x42 , if not, i set it using: HAL_FLASH_Unlock(); HAL_FLASH_Program(TYPEPROGRAM_BYTE, &userConfig[0], 0x42); HAL_FLASH_Lock(); After that I check the value in userConfig[0] and I see 0x42 ... Great! When I hit reset, however, and look at the location again, it's not 0x42 anymore... Any idea

STM32CubeMX USB CDC VCP?

帅比萌擦擦* 提交于 2019-11-27 14:06:18
问题 I've found large number of examples, but nothing on how to do it "properly" from STM32MXCube. How do I create skeleton code from STM32CubeMX for USB CDC virtual COM port communications (if possible STM32F4 Discovery)? 回答1: A STM32CubeMX project for Discovery F4 with CDC as USB device should work out of the box. Assuming you use an up-to-date STM32CubeMX and library: Start STM32CubeMX Select the board Discovery F4 Enable peripheral UBS_OTG_FS device only (leave over stuff uncheck) Enable