2024-02-08 05:51 PM - last edited on 2024-03-04 08:53 AM by Amel NASRI
Hello,
I have a custom board setup with an STM32G071GBUxN and a TCPP03-M20.
I have followed this STM guide for setting it up as a DRP device.
It is able to negotiate as a sink with Source only devices, and it is able to communicate over LPUART1 to show the current contract and trace messages. The problem is most of the rest of the UCPD GUI doesn't work and during device startup one of the messages that shows up in the trace is "GUI Memory is corrupted". The line of code that throws the "GUI Memory is corrupted" message is located in bsp_gui.c on line 89 where it checks for a magic number located at 0x801F800 in memory. When I inspect the memory upon debug startup (before any user code is run) that memory location does not have 0xDEADBABEDEADF00D. There are, however, two other memory addresses that have the magic number stored correctly, but the code doesn't check those locations.
It would be especially nice to have the VBUS and current plot portion of the UCPD GUI working for when I start implementing the SRC negotiation code.
And so, my questions are:
Any help is appreciated,
Nate
Solved! Go to Solution.
2024-03-13 02:09 PM
Hello,
I have since moved away from using the GUI portion of UCPD library to save flash. It would take a fair bit of setup for me to reproduce the issue, and this is no longer a roadblock for me.
Thanks,
Nate
2024-03-12 04:33 AM
Hi @NMartin
Would you share minimal of code to guide me how to reproduce the issue on our reference board nucleo G071 with its shield DRP?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-03-13 02:09 PM
Hello,
I have since moved away from using the GUI portion of UCPD library to save flash. It would take a fair bit of setup for me to reproduce the issue, and this is no longer a roadblock for me.
Thanks,
Nate
2024-03-14 07:48 AM - edited 2024-03-14 07:49 AM
Hi @NMartin
We would be grateful if you could help us reproduce this issue.
Otherwise, we appreciate your contribution and don't hesitate to come back and post new threads.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-02-13 03:20 PM - edited 2025-02-13 03:20 PM
Just a heads up, I ran into the exact same issue on an STM32U585 in a project with TrustZone enabled. The issue was that the INDEX_PAGE was placed into the last page of Flash for the Secure memory instead of the flash space for the non-secure project.
To fix this issue, I updated the compiler switches in usbpd_gui_memmap.h to use bank 2 (where the Non-Secure flash resides) if __ARM_FEATURE_CMSE is set to 1 (compiling for the Non-Secure project).
#if defined(FLASH_PAGE_NB)
/* Following definitions should be adapted to used Flash configuration :
INDEX_PAGE : represents the number of the page used for storing USBPD settings (usually the last page)
ADDR_FLASH_LAST_PAGE : Flash address value of beginning of USBPD settings page
ADDR_FLASH_PAGE_END : Flash address value of end of USBPD settings page
*/
#if defined(STM32L552xx) || defined(STM32L562xx)
#define INDEX_PAGE (FLASH_PAGE_NB - 1U) /* Index of latest page */
#else
#if defined (FLASH_OPTR_DBANK) || defined(FLASH_DBANK_SUPPORT) || (defined(__ARM_FEATURE_CMSE) && __ARM_FEATURE_CMSE == 1)
#define INDEX_PAGE ((FLASH_PAGE_NB * 2U) - 1U) /* Index of latest page */
#else
#define INDEX_PAGE (FLASH_PAGE_NB - 1U) /* Index of latest page */
#endif /* FLASH_OPTR_DBANK || FLASH_DBANK_SUPPORT */
#endif /* STM32L552xx || STM32L562xx */
#define ADDR_FLASH_LAST_PAGE (FLASH_BASE + (INDEX_PAGE * FLASH_PAGE_SIZE)) /* Base @ of latest page */
#define ADDR_FLASH_PAGE_END (ADDR_FLASH_LAST_PAGE + FLASH_PAGE_SIZE - 1U)
#define GUI_FLASH_MAGIC_NUMBER ADDR_FLASH_LAST_PAGE /* Base @ of magic number */
#else