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

nrf52840 interrupts not working with mbed-os + s140 softdevice

Hello everyone!

We are developing a device with the nRF52840 SoC and using mbed-os for developing firmware.

Everything works and runs normally when using mbed softdevice (Cordio) and no bootloader or DFU. The problem arises after enabling OTA updates that require having a booloader and the s140 sofdevice. The mbed code runs fine after OTA update (even the BLE stack) but the GPIO interrupts don't seem to be triggering.

As I read on the s140 datasheet, this softdevice forwards all interrupts to the main application but I can't find how to change my mbed configuration to be able to receive those signals from the s140.

I am using 0x27000 for the application start address, not sure if this is correct but it seems to work.

Any inputs or ideas are appreciated! 

Bruno

Parents
  • Hello Bruno,

    I am not familiar with mbed (that is, I am well aware of it, but no experience with it).

    The mbed OS doesn't use our softdevice, right? It uses Cordio? So before you added the bootloader you didn't include the Nordic Softdevice at all?

    How do you tell the bootloader that it should stay in DFU mode? Do you hold a button while power cycling, or did you just not have any applications in flash (only the bootloader) when you powered your device?

    For debugging purposes, can you try to set NRF_BL_DFU_ENTER_METHOD_BUTTON to 0 in sdk_config.h in your bootloader project?

    Without knowing anything more about mbed os, it is difficult to say why the pins aren't forwarded. I don't know how mbed usually receives the pin interrupts.

    To be honest it sounds a bit flaky (but not impossible) to combine the Bootloader which use the Softdevice from Nordic with a second BLE stack in the application. Have you looked into using Nordic's SDK for your application, or whether mbed has any DFU solutions?

    Best regards,

    Edvin

Reply
  • Hello Bruno,

    I am not familiar with mbed (that is, I am well aware of it, but no experience with it).

    The mbed OS doesn't use our softdevice, right? It uses Cordio? So before you added the bootloader you didn't include the Nordic Softdevice at all?

    How do you tell the bootloader that it should stay in DFU mode? Do you hold a button while power cycling, or did you just not have any applications in flash (only the bootloader) when you powered your device?

    For debugging purposes, can you try to set NRF_BL_DFU_ENTER_METHOD_BUTTON to 0 in sdk_config.h in your bootloader project?

    Without knowing anything more about mbed os, it is difficult to say why the pins aren't forwarded. I don't know how mbed usually receives the pin interrupts.

    To be honest it sounds a bit flaky (but not impossible) to combine the Bootloader which use the Softdevice from Nordic with a second BLE stack in the application. Have you looked into using Nordic's SDK for your application, or whether mbed has any DFU solutions?

    Best regards,

    Edvin

Children
  • Hello Edvin!

    Yes, Mbed uses Cordio but that's not a problem as it works fine after DFU. I did include the s140 SoftDevice when flashing the bootloader (I believe the Cordio resides in application memory).

    I have a button on my board that is connected to p0.24 and I changed the sdk_config.h file of the bootloader to use that pin. If I don't press it when power cycling, it boots correctly into my app. All works fine with OTA updates and bootloader.

    As per your last point, I think that is what my program is doing, I have 2 BLE stacks and only one is active at any point (Nordic in bootloader and Cordio in the application). I honestly love mbed as it's super easy to develop with but I might have to migrate to Nordic SDK. Mbed has some DFU solutions but I don't think are official or working very well.

    Is there any document on how the s140 stack forwards the interrupts?

    Thanks!

    Bruno

  • Hello,

    The softdevice will receive all interrupts, but for the peripherals that the softdevice doesn't use (such as the GPIOs), it will forward all of these interrupts to the application's NVIC. Is the application NVIC in mbed hardcoded? I don't know much details about this, because it usually isn't a problem. If you are not sure how the interrupts work in mbed, I suggest you check this in an mbed forum.

Related