This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2541: CC2541 hangs after software reset when switching from IMGB to IMGA

Part Number: CC2541

I observed a sporadic hangs on some devices when switching from Image B to Image A. The switching executes a LJMP to 0x830 like the BIM starts it up.
The hang always occurs in the BLE Stack when synchronising T2 to the 32K clock. The code location seems to be reading the RSSI value (not sure though).

The stack is Version 1.5.1.1.


00CC99 04 INC A
00CC9A F5 21 MOV V0,A
00CC9C A9 21 MOV R1,V0
00CC9E EE MOV A,R6
00CC9F FA MOV R2,A
00CCA0 EF MOV A,R7
00CCA1 FB MOV R3,A
00CCA2 90 02 86 MOV DPTR,#0x0286
00CCA5 E0 MOVX A,@DPTR
00CCA6 F5 83 MOV DPH,A
00CCA8 88 82 MOV DPL,R0
00CCAA 12 0F 1C LCALL 0x0F1C
00CCAD A9 22 MOV R1,V1
00CCAF 02 CB E4 LJMP 0xCBE4
00CCB2 A2 AF MOV C,IEN0.EA
00CCB4 E4 CLR A
00CCB5 33 RLC A
00CCB6 F8 MOV R0,A
00CCB7 C2 AF CLR IEN0.EA
00CCB9 53 94 FE ANL T2CTRL,#0xFE
00CCBC E5 94 MOV A,T2CTRL
00CCBE A2 E2 MOV C,A.2
00CCC0 40 FA JC 0x7CCBC
00CCC2 E8 MOV A,R0
00CCC3 A2 E0 MOV C,A.0
00CCC5 92 AF MOV IEN0.EA,C
00CCC7 75 A7 00 MOV T2IRQM,#0x00
00CCCA 75 A1 00 MOV T2IRQF,#0x00
00CCCD 75 9C FF MOV T2CSPCFG,#0xFF
00CCD0 75 C3 00 MOV T2MSEL,#0x00
00CCD3 75 A2 00 MOV T2M0,#0x00
00CCD6 75 A3 00 MOV T2M1,#0x00
00CCD9 75 A4 00 MOV T2MOVF0,#0x00
00CCDC 75 A5 00 MOV T2MOVF1,#0x00
00CCDF 75 A6 00 MOV T2MOVF2,#0x00
00CCE2 75 C3 11 MOV T2MSEL,#0x11
00CCE5 75 A2 00 MOV T2M0,#0x00
00CCE8 75 A3 00 MOV T2M1,#0x00
00CCEB 75 A4 00 MOV T2MOVF0,#0x00
00CCEE 75 A5 00 MOV T2MOVF1,#0x00
00CCF1 75 A6 00 MOV T2MOVF2,#0x00
00CCF4 75 C3 33 MOV T2MSEL,#0x33
00CCF7 75 A2 00 MOV T2M0,#0x00

When switching the 32MHz Clock manually in the debugger from Xtal to RC mode (and back) the loop ends and the device starts up as expected. I have tried to restore the clock configuration before jumping to Image A but with no luck. When trying to execute LL_Init(0) it hangs on a similar T2 sync loop. This behaviour I found in a recent production batch of 100 units on 2 devices. This prevents the end user from exercising OAD feature. Any ideas to overcome this issue?

void OS_reboot(char flash)
{
GAPRole_TerminateConnection();

#if defined(HAL_UART_DMA) && HAL_UART_DMA
HAL_DMA_ABORT_CH( HAL_DMA_CH_RX );
#endif

PREFETCH_DISABLE();
CLKCONCMD = 0xC9;
while (CLKCONSTA != 0xC9)
;

// HCI_ResetCmd();
// LL_Init(0);
// gapRole_SetupGAP();
#ifdef FEATURE_OAD_HEADER
if (flash)
{
HAL_DISABLE_INTERRUPTS();
JumpToImageAorB = 0;
// Simulate a reset for the Application code by an absolute jump to the expected INTVEC addr.
asm("LJMP 0x0830");
}
#else
VOID flash;
#endif
SystemReset();
}

  • I figured out what happened :-) The root cause was that on some modules the 32 KHz crystal was broken. Image B was not using sleep mode and the internal RC oscillator was used. Whereas the image B was compiled with the external 32 KHz crystal enabled. 

    Solution: compiled both images with disabled external 32 KHz crystal by setting XOSC32K_INSTALLED=FALSE in the preprocessor settings.