I try to migrate a working code from nRF52832 to nRF5340 with the use of 7002 companion chip for the network part (BLE). However, while I can jump to main and successfully run the program on nRF52, the RTC1_IRQHandler is triggered before I jump to main on nRF5340, and I fall into infinite wfi or even the default NMI handler. It ss because I call a custom function in the IRQ handler that hasn't been initialized yet :
At this point, mTimer is NULL so maybe this is why my functions are being populated weirdly. The thing is, I fall here :
If I don't test mTimer I end up in the default NMI handler forever.
The prj.conf of the nrf52 and nrf53 are very similar.
pjr_nrf5340.conf:
# Peripheral drivers # I2C # CONFIG_I2C CONFIG_NRFX_TWIM0=y CONFIG_NRFX_TWIM1=y # Timer # CONFIG_RTC=y # CONFIG_NRF_RTC_TIMER=y # CONFIG_NRFX_RTC1=y CONFIG_NRFX_TIMER2=y # GPIO CONFIG_NRFX_GPIOTE0=y CONFIG_NRFX_GPIOTE_NUM_OF_EVT_HANDLERS=5 # Flash CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_MPU_ALLOW_FLASH_WRITE=y # Others CONFIG_NRFX_PWM0=y CONFIG_NRFX_SPIM1=y CONFIG_NRFX_SPIM2=y CONFIG_NRFX_RNG=y CONFIG_NRFX_UARTE0=y CONFIG_NRFX_NVMC=y # BLE CONFIG_BT=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_DEVICE_NAME_DYNAMIC=y CONFIG_BT_CTLR_CONN_RSSI=y CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y CONFIG_BT_MAX_CONN=1 # Power management CONFIG_POWEROFF=y CONFIG_RESET_ON_FATAL_ERROR=y # Logging CONFIG_USE_SEGGER_RTT=y # Enable printf floating point support beware this take up to 7ko of flash CONFIG_CBPRINTF_FP_SUPPORT=y # Build options CONFIG_BUILD_NO_GAP_FILL=y CONFIG_MAIN_STACK_SIZE=8192
prj_nrf52.conf :
# Peripheral drivers # I2C CONFIG_NRFX_TWI0=y CONFIG_NRFX_TWI1=y # Timer CONFIG_NRFX_TIMER2=y # GPIO CONFIG_NRFX_GPIOTE0=y CONFIG_NRFX_GPIOTE_NUM_OF_EVT_HANDLERS=5 # Flash CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_MPU_ALLOW_FLASH_WRITE=y # Others CONFIG_NRFX_PWM0=y CONFIG_NRFX_SPI0=y CONFIG_NRFX_RNG=y CONFIG_NRFX_UART0=y CONFIG_NRFX_NVMC=y # BLE CONFIG_BT=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_DEVICE_NAME_DYNAMIC=y CONFIG_BT_CTLR_CONN_RSSI=y CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y CONFIG_BT_MAX_CONN=1 # Power management CONFIG_POWEROFF=y CONFIG_RESET_ON_FATAL_ERROR=y # Logging CONFIG_USE_SEGGER_RTT=y # Enable printf floating point support beware this take up to 7ko of flash CONFIG_CBPRINTF_FP_SUPPORT=y # Build options CONFIG_BUILD_NO_GAP_FILL=y CONFIG_MAIN_STACK_SIZE=8192
The things that differs the most is that I use the 7002 as companion chip. I know this guy is responsible for some pre-main initializations. I tried to debug the nrf53_sync_rtc sample after adding RTC1_IRQHandler, and I don't have the issue : I first jump into the main, and after the IRQ_CONNECT, I break in the IRQ_Handler.
Can someone explain please? Thank you for you help