2014-11-25 06:37 AM
Hi, usb hid works form me great on discovery f4 but I have a problem with saving to backup sram and backup rtc after USB initialization. I would like to create a program, which is waiting for character from the USB then enters information into backup sram or
backup
rtc. Put data into backup memory works without USB initialization. But when I want to write something to it after the USB initialization compiler does not detect an error in the program but the memory content does not change, no entry into the memory. Initialization looks like this:USBD_Init (& USB_OTG_dev,
USB_OTG_FS_CORE_ID, & USR_desc, & USBD_HID_cb, & USR_cb);Any ideas? I have tried many of variance startup but nothing is working. I did off usb global init, stop device, disconnect device... nothing seems to be working.
Every new idea will be helpful!
Regards.
Amidns #backup #usb-sram-stm32f2-backup #usb-hid #stm32f42014-11-25 08:51 AM
Wouldn't the code fiddling with the RAM be more pertinent to the problem? Are the clocks to the backup/power domain enabled, and have you unlocked access to it?
2014-11-25 11:15 PM
My function write_to_backup_sram:
int8_t write_to_backup_sram( uint8_t *data, uint16_t bytes, uint16_t offset ){ uint8_t* base_addr = (uint8_t *) BKPSRAM_BASE; uint16_t i; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_BKPSRAM, ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); PWR_BackupAccessCmd(ENABLE); PWR_BackupRegulatorCmd(ENABLE); for( i = 0; i < bytes; i++ ) { *(base_addr + offset + i) = *(data + i); //TEST VALUES } PWR_BackupAccessCmd(DISABLE); return 0;} Something is missing? But it works without USB init.2016-03-17 04:05 AM
Did anyone ever find an answer to this?
I have exactly the same problem with an STM32F205VE. I can read and write from the battery backed up SRAM just fine until I implement USB VCP. As soon as the USB stack is initialised, the backup SRAM seems to become read only! I can find no mention of this 'feature' in any datasheet.The processor does not throw a fault if you try to write to to the backup SRAM, it just doesn't update the RAM. It is also no longer possible to update the backup SRAM via JTAG once the USB has been initialised. again, there is no error, it just does not change the values. I have tried every possible Google search that I can think of to find a solution to this problem and this post is the only thing I have found!Can anyone throw any light on this problem?RegardsTim2016-03-17 08:05 AM
Did anyone ever find an answer to this?
Hard to say, there have been a number of issues with USB_Init() stomping on things, in different threads. Might want to Google a bit more generally.2016-05-23 11:38 PM
How you read this data?
2016-05-24 06:11 AM
How you read this data?
The same way you read all the other memory. You could use a pointer, a structure pointer, or via sections and linker scripts or scatter files.2016-05-24 10:15 PM
thank you clive1.
2019-01-14 11:06 AM
Has anyone found a solution to this? I am running into the same problem, and nothing I can find in the documentation indicates why.
2019-01-14 01:32 PM
Try to be more specific.
JW