Other Parts Discussed in Thread: SYSBIOS, BLE-STACK
I have a big complex ProjectZero based project that includes 2 periodic cycle clocks (one at 1ms and one at 2000ms) , an external flash, I2C and UART code.
The code works well communicating with a UART device, four I2C devices, external flash and a BLE IOS App which I developed.
I have just recently been able to initiate a sleep/standby state of <10ua current after I sense that 2.8v has been removed from IOID_14 by stopping my periodic cycle clocks, stopping advertising on BLE plus closing all my pins, I2C, and UART.
Wakeup from sleep is triggered by an interrupt of IOID_14 when 2.8v is applied to the pin, at which point I restart my periodic cycle clocks, reopen all my pins/I2C/UART and start advertising on BLE again.
I have coded a yellow LED to only ever come on for 2 seconds (and then goes off) each time that the main.c main() function is run. This lets me know if there is a problem waking up that initiates the main() function code as in a restart that will start the RTC from zero and initialize all ram variables again (both of which should not occur after waking from sleep).
Running stand alone without debugging in CSS by JTAG cable, I apply 2.8 volts on IOID_14 during this <10ua sleep state and the Yellow LED comes on for 2 seconds. This is not an expected behavior.
To debug this issue I run a CCS debug session, run the code and then:
- Initiate the sleep by removing 2.8v from IOID_14
- I enable a breakpoint at a point where my 1ms periodic cycle clock trigger has been recognized in my ProjetZero_taskFxn loop.
- Apply 2.8v to IOID_14. At which point the code execution breaks at my enabled breakpoint which indicates that the pin interrupt has occurred, my ProjetZero_taskFxn loop has started again and my 1ms periodic cycle clock has triggered.
- I then begin single stepping through the code with F5 and after a few steps my code stops executing however the code stills runs/pauses and be continued.
- When I pause in this 'hung' state I am able to use ROV to see that an Hard Fault: FORCED: USAGE: NOCP exception has occurred:


Most of the time in this 'hung' state is spent looping through the above 4 lines 1001b180 to 1001b188.
Here is a disassembly listing with RTOS ROV symbols added for an area just before that loop and up the the line where the loop exits to once in a while:
ti_sysbios_knl_Task_schedule__I():
1001b174: B570 push {r4, r5, r6, lr}
1001b176: 4C11 ldr r4, [pc, #0x44]
1001b178: 2600 movs r6, #0
1001b17a: 25F8 movs r5, #0xf8
$C$L37:
1001b17c: 8126 strh r6, [r4, #8]
1001b17e: E001 b $C$L39
$C$L38:
1001b180: F000F8F0 bl #0x1001b364
$C$L39:
1001b184: 6860 ldr r0, [r4, #4]
1001b186: 2800 cmp r0, #0
1001b188: D0FA beq $C$L38
1001b18a: 6860 ldr r0, [r4, #4]
1001b18c: 69A3 ldr r3, [r4, #0x18]
1001b18e: 6962 ldr r2, [r4, #0x14]
1001b190: FAB0F080 clz r0, r0
1001b194: EBA501C0 sub.w r1, r5, r0, lsl #3
1001b198: 1858 adds r0, r3, r1
1001b19a: 4282 cmp r2, r0
1001b19c: D20A bhs $C$L40
1001b19e: 6922 ldr r2, [r4, #0x10]
1001b1a0: 6160 str r0, [r4, #0x14]
1001b1a2: F001F897 bl #0x1001c2d4
1001b1a6: 4601 mov r1, r0
1001b1a8: 6121 str r1, [r4, #0x10]
1001b1aa: F1020010 add.w r0, r2, #0x10
1001b1ae: 3110 adds r1, #0x10
1001b1b0: F001F8A4 bl #0x1001c2fc
$C$L40:
1001b1b4: 8920 ldrh r0, [r4, #8]
1001b1b6: 2800 cmp r0, #0
1001b1b8: D1E0 bne $C$L37
1001b1ba: BD70 pop {r4, r5, r6, pc}
$C$CON34:
1001b1bc: 0100 lsls r0, r0, #4
1001b1be: 2000 movs r0, #0
ti_sysbios_family_arm_m3_Hwi_Module_startup__E():
1001b1c0: B570 push {r4, r5, r6, lr}
1001b1c2: 2020 movs r0, #0x20
1001b1c4: F3808811 .word 0x8811f380
1001b1c8: 4A0D ldr r2, [pc, #0x34]
1001b1ca: 6991 ldr r1, [r2, #0x18]
1001b1cc: 6950 ldr r0, [r2, #0x14]
1001b1ce: F04F35FF mov.w r5, #-1
1001b1d2: F0200007 bic r0, r0, #7
1001b1d6: 1809 adds r1, r1, r0
1001b1d8: 480A ldr r0, [pc, #0x28]
1001b1da: 6015 str r5, [r2]
1001b1dc: 3908 subs r1, #8
1001b1de: 6804 ldr r4, [r0]
1001b1e0: 6111 str r1, [r2, #0x10]
1001b1e2: 2C00 cmp r4, #0
1001b1e4: DD0A ble $C$L565
1001b1e6: 2600 movs r6, #0
$C$L564:
1001b1e8: 2000 movs r0, #0
1001b1ea: 4631 mov r1, r6
1001b1ec: F000FAE8 bl #0x1001b7c0
1001b1f0: 2100 movs r1, #0
1001b1f2: F7FFF891 bl #0x1001a318
1001b1f6: 1C76 adds r6, r6, #1
1001b1f8: 1E64 subs r4, r4, #1
1001b1fa: D1F5 bne $C$L564
$C$L565:
1001b1fc: 4628 mov r0, r5
1001b1fe: BD70 pop {r4, r5, r6, pc}
$C$CON631:
1001b200: 0144 lsls r4, r0, #5
1001b202: 2000 movs r0, #0
$C$CON633:
1001b204: 0494 lsls r4, r2, #0x12
1001b206: 0000 movs r0, r0
ti_sysbios_heaps_HeapMem_getStats__E():
1001b208: B570 push {r4, r5, r6, lr}
1001b20a: 4605 mov r5, r0
1001b20c: 6928 ldr r0, [r5, #0x10]
1001b20e: 460C mov r4, r1
1001b210: 6020 str r0, [r4]
1001b212: 2000 movs r0, #0
1001b214: 6060 str r0, [r4, #4]
1001b216: 60A0 str r0, [r4, #8]
1001b218: 480C ldr r0, [pc, #0x30]
1001b21a: 6806 ldr r6, [r0]
1001b21c: 4630 mov r0, r6
1001b21e: F001F83D bl #0x1001c29c
1001b222: 4601 mov r1, r0
1001b224: 68E8 ldr r0, [r5, #0xc]
1001b226: B160 cbz r0, #0x1001b242
1001b228: 6862 ldr r2, [r4, #4]
1001b22a: 68A3 ldr r3, [r4, #8]
$C$L421:
1001b22c: 6845 ldr r5, [r0, #4]
1001b22e: 18AA adds r2, r5, r2
1001b230: 6062 str r2, [r4, #4]
1001b232: 6845 ldr r5, [r0, #4]
1001b234: 429D cmp r5, r3
1001b236: BF84 itt hi
1001b238: 1C2B adds r3, r5, #0
1001b23a: 60A3 str r3, [r4, #8]
1001b23c: 6800 ldr r0, [r0]
1001b23e: 2800 cmp r0, #0
1001b240: D1F4 bne $C$L421
$C$L422:
1001b242: 4630 mov r0, r6
1001b244: F001F82C bl #0x1001c2a0
1001b248: BD70 pop {r4, r5, r6, pc}
1001b24a: 46C0 mov r8, r8
$C$CON442:
1001b24c: 04B8 lsls r0, r7, #0x12
1001b24e: 0000 movs r0, r0
ti_sysbios_knl_Mailbox_Module_startup__E():
1001b250: 4810 ldr r0, [pc, #0x40]
1001b252: B538 push {r3, r4, r5, lr}
1001b254: 6804 ldr r4, [r0]
1001b256: 2C00 cmp r4, #0
1001b258: DD19 ble $C$L367
1001b25a: 2500 movs r5, #0
$C$L364:
1001b25c: 2000 movs r0, #0
1001b25e: 4629 mov r1, r5
1001b260: F000FB1C bl #0x1001b89c
1001b264: 4602 mov r2, r0
1001b266: 68D0 ldr r0, [r2, #0xc]
1001b268: B948 cbnz r0, #0x1001b27e
1001b26a: F001FAF5 bl #0x1001c858
1001b26e: 6851 ldr r1, [r2, #4]
1001b270: 1840 adds r0, r0, r1
1001b272: 1DC1 adds r1, r0, #7
1001b274: F001FAF0 bl #0x1001c858
1001b278: 1E40 subs r0, r0, #1
1001b27a: 4381 bics r1, r0
1001b27c: E001 b $C$L366
$C$L365:
1001b27e: 6851 ldr r1, [r2, #4]
1001b280: 3108 adds r1, #8
$C$L366:
1001b282: 4610 mov r0, r2
1001b284: F000FB20 bl #0x1001b8c8
1001b288: 1C6D adds r5, r5, #1
1001b28a: 1E64 subs r4, r4, #1
1001b28c: D1E6 bne $C$L364
$C$L367:
1001b28e: F04F30FF mov.w r0, #-1
1001b292: BD38 pop {r3, r4, r5, pc}
$C$CON355:
1001b294: 04CC lsls r4, r1, #0x13
1001b296: 0000 movs r0, r0
ti_sysbios_family_arm_m3_Hwi_disableInterrupt__E():
1001b298: 4A0F ldr r2, [pc, #0x3c]
1001b29a: 2810 cmp r0, #0x10
1001b29c: D20B bhs $C$L14
1001b29e: 280F cmp r0, #0xf
1001b2a0: BF18 it ne
1001b2a2: 2000 movs r0, #0
1001b2a4: D115 bne $C$L15
1001b2a6: 6910 ldr r0, [r2, #0x10]
1001b2a8: 6911 ldr r1, [r2, #0x10]
1001b2aa: F0000002 and r0, r0, #2
1001b2ae: F0210102 bic r1, r1, #2
1001b2b2: 6111 str r1, [r2, #0x10]
1001b2b4: E00D b $C$L15
$C$L14:
1001b2b6: 3810 subs r0, #0x10
1001b2b8: 2101 movs r1, #1
1001b2ba: F000031F and r3, r0, #0x1f
1001b2be: 08C0 lsrs r0, r0, #3
1001b2c0: 4099 lsls r1, r3
1001b2c2: F0200003 bic r0, r0, #3
1001b2c6: 1812 adds r2, r2, r0
1001b2c8: F8D20100 ldr.w r0, [r2, #0x100]
1001b2cc: F8C21180 str.w r1, [r2, #0x180]
1001b2d0: 4008 ands r0, r1
$C$L15:
1001b2d2: BF00 nop
1001b2d4: 4770 bx lr
1001b2d6: 46C0 mov r8, r8
$C$CON4:
1001b2d8: E000 b ti_sysbios_family_arm_m3_Hwi_enableInterrupt__E
1001b2da: E000 b #0x1001b2de
ti_sysbios_family_arm_m3_Hwi_enableInterrupt__E():
1001b2dc: 4A0F ldr r2, [pc, #0x3c]
1001b2de: 2810 cmp r0, #0x10
1001b2e0: D20B bhs $C$L450
1001b2e2: 280F cmp r0, #0xf
1001b2e4: BF18 it ne
1001b2e6: 2000 movs r0, #0
1001b2e8: D115 bne $C$L451
1001b2ea: 6910 ldr r0, [r2, #0x10]
1001b2ec: 6911 ldr r1, [r2, #0x10]
1001b2ee: F0000002 and r0, r0, #2
1001b2f2: F0410102 orr r1, r1, #2
1001b2f6: 6111 str r1, [r2, #0x10]
1001b2f8: E00D b $C$L451
$C$L450:
1001b2fa: 3810 subs r0, #0x10
1001b2fc: 2101 movs r1, #1
1001b2fe: F000031F and r3, r0, #0x1f
1001b302: 08C0 lsrs r0, r0, #3
1001b304: 4099 lsls r1, r3
1001b306: F0200003 bic r0, r0, #3
1001b30a: 1812 adds r2, r2, r0
1001b30c: F8D20100 ldr.w r0, [r2, #0x100]
1001b310: F8C21100 str.w r1, [r2, #0x100]
1001b314: 4008 ands r0, r1
$C$L451:
1001b316: BF00 nop
1001b318: 4770 bx lr
1001b31a: 46C0 mov r8, r8
$C$CON471:
1001b31c: E000 b ti_sysbios_knl_Swi_post__E
1001b31e: E000 b #0x1001b322
ti_sysbios_knl_Swi_post__E():
1001b320: B538 push {r3, r4, r5, lr}
1001b322: 4603 mov r3, r0
1001b324: F3EF8411 .word 0x8411f3ef
1001b328: 2020 movs r0, #0x20
1001b32a: F3808811 .word 0x8811f380
1001b32e: 8B98 ldrh r0, [r3, #0x1c]
1001b330: B998 cbnz r0, #0x1001b35a
1001b332: 2001 movs r0, #1
1001b334: 8398 strh r0, [r3, #0x1c]
1001b336: F000FECD bl #0x1001c0d4
1001b33a: 4605 mov r5, r0
1001b33c: 6A98 ldr r0, [r3, #0x28]
1001b33e: 4619 mov r1, r3
1001b340: F000FF38 bl #0x1001c1b4
1001b344: 4906 ldr r1, [pc, #0x18]
1001b346: 6998 ldr r0, [r3, #0x18]
1001b348: 684A ldr r2, [r1, #4]
1001b34a: 4310 orrs r0, r2
1001b34c: 6048 str r0, [r1, #4]
1001b34e: F3848811 .word 0x8811f384
1001b352: B925 cbnz r5, #0x1001b35e
1001b354: F7FFFE6C bl #0x1001b030
1001b358: BD38 pop {r3, r4, r5, pc}
$C$L305:
1001b35a: F3848811 .word 0x8811f384
$C$L306:
1001b35e: BD38 pop {r3, r4, r5, pc}
$C$CON248:
1001b360: 01C8 lsls r0, r1, #7
1001b362: 2000 movs r0, #0
ti_sysbios_knl_Task_allBlockedFunction__I():
1001b364: B508 push {r3, lr}
From that listing it appears that code is sometimes transitioning from ti_sysbios_knl_Task_schedule__I to ti_sysbios_knl_Task_allBlockedFunction__I.
Which seems to indicate that all tasks are blocked during this 'hung' state.
During this 'hung' state ROV supports this 'all tasks blocked' status by these images:



Can someone please help and/or perhaps suggest how to investigate the task scheduler and determine how/why all tasks revert to blocked after waking up?
Thanks,
Dale
NOTE: Here is the point in another topic where this issue was first discovered/discussed and eventually a decision was made to start this new topic:
