2021-08-04 08:37 AM
Hello!
I just started working with the Nucleo-L4R5ZI board and came across an odd issue. I setup a project, built and ran it, and I'm having it get the following error after running the MX_USB_OTG_FS_PCD_Init() function. Below is my main, pretty straight forward:
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_LPUART1_UART_Init();
MX_USART3_UART_Init();
MX_USB_OTG_FS_PCD_Init(); <---- Never makes it out of this function
MX_I2C1_Init();
MX_SPI1_Init();
MX_ADC1_Init();
MX_CRC_Init();
MX_TIM2_Init();
MX_TIM16_Init();
MX_FATFS_Init();
It never makes it out of the MX_USB_OTG_FS_PCD_Init() function. I hit the pause button and get this info:
Break at address "0x1fff16d2" with no debug information available, or outside of program code.
I dove deeper and it gets stuck on the following line:
/* Force Device Mode*/
(void)USB_SetCurrentMode(hpcd->Instance, USB_DEVICE_MODE);
I'll include a full screenshot with more information:
I suspect the issue has less to do with the library/functions than it does with something setup incorrectly with the linker file if it's going out of bounds but I could be wrong. To be honest, I'm not really sure what's going on (much less how to fix it).
Here's my linker file, if this helps (I assume this is the important part):
/* Entry Point */
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
_Min_Heap_Size = 0x200 ; /* required amount of heap */
_Min_Stack_Size = 0x400 ; /* required amount of stack */
/* Memories definition */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 640K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K
}
Any suggestions you can give me would be greatly appreciated. Thanks!
2021-08-04 08:44 AM
2021-08-04 09:38 AM
Thanks for that! I backed up the files in "C:\ST\STM32CubeIDE_1.6.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_1.6.0.202101291314\tools\bin\FlashLoader" and replaced them with the new files from that thread. Unfortunately, instead of starting in main, it now starts directly in the fault handler . . . I tried restarting the program, cleaning it, rebuilding it, same issue.
I then tried to roll it back, put in the previous files and it now starts in the fault handler as well. This isn't great . . . did I do something wrong? Why wouldn't rolling back to the previous files fix the issue? I'm not entirely sure what happened but now the entire environment seems to be broken rather than just that project . . .
2021-08-04 02:29 PM
Then just debug the fault as usually.
Cube is open source and forms part of your program.
JW