This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

task_yield results in hard fault.

Hi.

I have a RAK5010 i use for iot application.

i recently moved from SDK 15.20 to sdk 16.
I use the task manager to manage two tasks:

1. task to dump nrf logs

2. task to handle the GSM and  main loop.

in the near future i do expect to add some more tasks or at least use more the task_Wait, for the time being each task is a for(;;) loop with task_yield in it's end.

since sdk 16 i have an issue with task_yield, the first task task yield works fine, the other task starts running and when it calls task yield i get hard fault. The hard fault occurs since the PC is 0x0000! the LR showed me the return address is just AFTER task_switch was called from task_yield function. adding SEGGER_RTT_printf also sows that (i wrap the task_Switch function with prints, both show).
That means that after the task switch for some reason the processor is sure 0x0000 is the right address to go.

Any hint on that would be appreciated, if it's my software that corrupts the stack before the task_yield call, how do i test that ?

Parents Reply
  • Hello,

    You can do a register read command using the nrfjprog (nRF command line tools). You can use the command "nrfjprog --readregs" and it will print out all the registers.

    You say that you added a task to flash the logs. Do you call this task from several places? That is, is it a risk for the log flush to be interrupted by another log flush? If so, then this may be the issue. You should only flush the logs from one instance, because of how it the log module is built up, it may cause an issue if it is flushed from several places.

    BR,

    Edvin

Children
Related