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

Task Manager doesn't execute Idle task

Hi,

  I'm leveraging the ble_app_cli example program for my project. The primary reason for this is that I need BLE and I need to be able store and retrieve log data which needs to survive across power cycles.  My plan is to use flashlog for this functionality.  I see that the only way to retrieve the logs is using the CLI.  Therefore, the ble_app_cli example seemed like a good place to start.  If I build and run this example on my nRF52840 DK, it runs correctly some of the time.  I always get the CLI menu when I press TAB, and the CLI commands are functional.  But sometimes, the battery level simulation data does not get output.  Other times it does.  After leveraging this code into my own project, I see the same behavior.  When the battery data does not get output, I tried setting a breakpoint in the call to NRF_LOG_PROCESS(), and I see that it doesn't get there.  So it looks like the idle task stops running once the CLI task starts, at least some of the time.

  Again, I'm able to see this behavior using the unmodified ble_app_cli example.  Another thing I noticed is that if I do not make a BLE connection, the app shuts down after about 3 minutes.  When this happens, all of the previous battery level updates are printed on the serial terminal.  So the data is getting logged, it's just not getting output because NRF_LOG_PROCESS is not running, because the idle task is not running.

00:03:22.000,183] <info> app: Battery level update: 87
Logs dropped (1)
[00:03:24.000,183] <info> app: Battery level update: 88
Logs dropped (1)
[00:03:26.000,183] <info> app: Battery level update: 89
Logs dropped (1)
[00:03:28.000,183] <info> app: Battery level update: 90
Logs dropped (1)
[00:03:29.939,758] <info> pwr_mgmt: Shutdown request 0
Logs dropped (1)
[00:03:29.939,758] <info> pwr_mgmt: Shutdown started. Type 0
Logs dropped (1)
[00:03:29.939,758] <info> pwr_mgmt: SysOff handler 0x000355D1 => ready
Logs dropped (1)
[00:03:29.939,758] <info> pwr_mgmt: Shutdown complet

  Any thoughts on how to fix this, or ideas for other approaches - possibly something that doesn't use task manager.  I don't see it used much in other examples.  Is it possible to use the CLI and BLE without task manager?

  Thanks...

Brian

  • Hi Brian

    What SDK version are you using when testing the ble_app_cli example exactly? As it is an experimental example, it is more prone to bugs and have undergone less testing than the other SDK example projects.

    I'm not sure the CLI example is the best approach for storing logging data in the Flash memory of your nRF device, which is what you want to do if I understand you correctly. The Flash logger backend might suit you better, which is used to store logs in non-volatile memory and supports FAT or LittleFS for storage.

    Best regards,

    Simon

  • Hi Simon,

      I am using SDK 17.0.2.

      One of the reasons I picked ble_app_cli was because it supported flashlog.  If this is not the right example to start with, what would you recommend?  I did not see an easy way to retrieve flashlog contents without the CLI, which is why I picked something with CLI support.  It sounds like you would recommend staying away from the task_manager, which I'm fine with. 

      Is there a recommended example to start with that supports BLE (I need both central and peripheral roles), and flashlog capability (both storing and retrieving data that is persistent across power cycles).  At this point, I'm looking for the best starting point that gets me closest to the functionality I need, as well as a path to get there.

      For instance, is it feasible to start with something like the ble_app_uart example and then integrate the peripheral/cli example?

      Thanks...

    Brian

  • Hi Brian

    Sorry, I seem to have misinformed you. The ble_app_cli example seems to be the only BLE example in our SDK utilizing the flashlog. I didn't think that was the case. 

    I have tested this on my end now, and I'm not able to see what exactly you're referring to? Are you expecting the battery measurements to print continuously or what? The battery level updates seem to work as intended at all times on my end, printing the battery levels every time I put the device to sleep or when the timeout occurs. The CLI library uses the task manager, so I think you'll have to use it.

    Yes, it should also be possible to start out with an example like the ble_app_uart and add the CLI to that.

    Best regards,

    Simon

  • Hi Simon,

      When I ran the ble_app_cli app, it would sometimes print battery measurements each second.  Other times I ran it, I would get no output until the app reset after ~3 minutes of no BLE connection.  At this point, I would get a large number of battery measurements at the same time.

      I've switched to the ble_app_uart example, and added CLI and flashlog support to this example, with no task manager.  So far, it is working well, so I plan to keep going with this approach.

      Thanks for the help!

    Brian

Related