LPUART sample, interrupt driven, not working on nRF5340DK

I am trying to get the lpuart sample, interrupt driven, working on an nRF5340DK board. When I run the compiled sample on my DK board I see the interrupt routine is hit only once and no data is sent as observed using a Saleae device. Following the first interrupt hit, the TX line will go low at every iteration through the sample loop but no data and no calls to the interrupt handler. I have also tried this on an nRF52840DK with the same result. Any ideas as to what I might be missing?

I am building with the nrf5340dk_nrf5340_cpuapp_ns board configuration with the nRF Connect SDK v2..3.0 SDK installed with nF Connect.

5340.prj.conf

6811.zephyr.dts

  • Hello,

    I was not able to reproduce the issue with the Low Power UART sample when I built it for 'nrf5340dk_nrf5340_cpuapp' which is one of the supported targets: 

    Can you please try with nrf5340dk_nrf5340_cpuapp and see if you get the same result? I also tried nrf5340dk_nrf5340_cpuapp_ns, but it didn't work because something is triggering a fault exception in TFM. I haven't had the time to debug it further.

    Best regards,

    Vidar

  • Hi Vidar,

    Thank you for looking into this. 

    I tried the nrf5340dk_nrf5340_cpuapp build and that did work. Curious about why I was seeing different results than you with the nrf5340dk_nrf5340_cpuapp_ns build I did some digging. I found that in my dts for the _ns build I had my UART pins incorrectly assigned i.e. they were all shifted by 1. Having corrected that, I am also getting a fault exception. I will include my dts overlay for reference. 

    I should also note that this issue is part of a bigger project. I've used the lpuart example since it also failed to function and is less complicated. In the larger project I get an unhandled interrupt exception regardless of which build option I use i.e. with _ns or without. So I will leave it to you to decide whether we continue with lpuart and hope the resolution there will result in a solution on my target or, jump strait to my target build and not mess with the sample. 

    1222.nrf5340dk_nrf5340_cpuapp.overlay

    Best regards,

    Kyle

  • Hi Kyle, 

    I was able to reproduce the "unhandled interrupt" error today. I'm not sure why I overlooked it yesterday. The issue for me happened because I had simply copied the 'nrf5340dk_nrf5340_cpuapp.overlay' when creating the overlay for the '5340dk_nrf5340_cpaupp_ns' target and this overlay was hardcoding the IRQ# for the GPIOTE here:

    GPIOTE0 is a secure peripheral and is used when you build for non *_ns targets.

    Fixed overlay:

    0020.nrf5340dk_nrf5340_cpuapp_ns.overlay

    Best regards,

    Vidar

  • Hi Vidar,

    This is good information on the interrupt mapping between secure and non-secure builds. The new mapping appears to be working. Thank you!

    One more question, where is that interrupt map table you posted in your last response located?

    Best regards,

    Kyle

  • Hi Kyle,

    I'm glad to hear that it appears to be working for you as well. The IRQ numbers can be found in the nrf5340_application.h  header located in /modules/hal/nordic/nrfx/mdk/

    Best regards,

    Vidar

Related