Problem running code in release mode when NRF_LOG_BACKEND_UART_ENABLED and NRF_LOG are disabled

Hello,

I am having an issue with running my application in release mode. It will only run when NRF_LOG_ENABLED = 1 and NRF_LOG_BACKEND_UART_ENABLED = 1. I can run my debug configuration with both of these disabled. I would like to disable them as it reduces power consumption of my device. I can run the debugger in the release config and the device will advertise and i can connect to it but it doesn't work when i flash the hex file.

I've tried setting optimization level to 'none' for release build and I've tried disabling and enabling the logs and uart.

Any help with this is appreciated.

Thanks

Parents
  • Hello,

    Thanks for your response.

    When i disable the UART and NRF Log I can build the project in release mode but when i flash the hex file the device will not advertise. As soon as i enable the log and UART the device will advertise and behave like normal but draw more power than we would like.

    I can run the debugger with the UART and NRF logs disabled and the device advertises as per normal.

    I will investigate the HFCLK.

    Thanks

  • Hi again, 
    Yes that's why I suggested to use GPIO or otherway of debugging to check where the code stop. Have you tried to do RTT log instead of UART ?

  • Hi Jonathan, 
    I couldn't see anything suspicious in the regs. 
    But you can check what the PC:0x002B9D2 point to with the addr2line.exe tool, it should be able to point you to where the program counter stuck at. I would suggest to try nrfjprog --readregs some more times to see the PC is still in the same area. 

    Which SDK and softdevice version are you using ? 

    Could you try not to put the CPU to sleep in the main loop to see if you still have the same problem ? 

    Have you looked at anything else that can cause your application different from the blinky ?

    You can try to disable the functionality one by one until your application getting similar to the blinky. For example the code that you interface with the external peripheral. 


  • Hello,

    We are running soft device 132 and SDK 17.0.2

    I've managed to isolate the problem to the SPI clock to our ADC. It was set to 8 MHZ which seemed to work during debug config or in release config when we have NRF_LOG_ENABLED = 1 and NRF_LOG_BACKEND_UART = 1. When i disabled the log and uart it does not work in release config until I switch SPI back to 1 MHZ. 

    Any ideas why this would happen? The ADC runs at up to 10 MHZ. We would like to run the bus as fast as possible to maximise down time.

    Thanks

  • Hi Jonathan, 
    Could you try the suggestion from Susheel in this ticket to see if it has something to so with the HFCLK ?
    RE: SPI with BLE Stack 

    You can also try testing with BLE turn off (don't start advertising) to see if it's the issue with BLE stack disable HFCLK or not. If it still doesn't work with BLE turn off, then you may want to try testing with simple SPI example in the SDK if you can reproduce the issue with these examples. 

  • Hello,

    Thank you for the suggestion but i am not having much luck calling sd_clock_hfclk_request(). I've tried calling it after BLE is initialised and before my ADC is used but it doesn't seem to help. One other thing I've realized is that my device will advertise if my Segger j link is unplugged then reconnected to the device, even when spi is set to 8 mhz.

    Thanks

  • Hi Jonathan, 
    If you test with only the SPI (use a SPI example) do you see the same problem ?

    Have you tried to test with our Dev Kit ? 

Reply Children
No Data
Related