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

UART2 not working in http_application_update example

Hi,

I am using v0.4.0 ncs sdk.

I added following in the nrf9160_pca10090ns.overlay file

&uart2 
{ 
   status = "ok"; 
   current-speed = < 9600 >;
   tx-pin = < 16 >;
   rx-pin = < 17 >;
   rts-pin = < 18 >;
   cts-pin = < 19 >;
};

I added following in the prj.conf file 

# UART 2 
CONFIG_SERIAL=y
CONFIG_UART_NRFX=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_2_NRF_UARTE=y

I added following in the application 

    struct device   *uart2;
    uart2 = device_get_binding("UART_2");
    uart_irq_callback_set(uart2, UDi_Uart2RxInt);
    uart_irq_rx_enable(uart2);

But when i run the code i am getting hard fault error when "uart_irq_callback_set(uart2, UDi_Uart2RxInt);" 

function is called. 

***** Booting Zephyr OS 1.14.99 *****<CR><LF>
Exception occurred in Secure State<CR><LF>
***** HARD FAULT *****<CR><LF>
Fault escalation (see below)<CR><LF>
***** BUS FAULT *****<CR><LF>
Precise data bus error<CR><LF>
BFAR Address: 0x50008120<CR><LF>
***** Hardware exception *****<CR><LF>
Current thread ID = 0x20021788<CR><LF>
Faulting instruction address = 0x199ea<CR><LF>
Fatal fault in ISR! Spinning...<CR><LF>

Can you help me in resolving this error ?

Regards,

Smitesh Mali

Parents
  • Have you set the UARTE2 peripheral as non-secure in SPM?

    The application executes in the non secure context, and can only access peripherals and memory regions explicitly set as non-secure accessible by the SPM (Secure Partition manager).

    The SPM is a separate image which is automatically built and merged in when working with the pca10090ns board.
    To configure SPM to allow non-secure access to a given peripheral, one must edit the SPM image, not the regular app.

    This can be done through menuconfig (not persistent) or in the SPMs prj.conf file (persistent):

    Menuconfig:
    1.Run ninja spm_menuconfig in the project build folder
    2. Navigate to Modules > Nordic nRF Connect > SPM > Current app is SPM
    3. Set UARTE2 is Non - Secure

    prj.conf:
    echo "CONFIG_SPM_NRF_UARTE2_NS=y" >> $ZEPHYR_BASE/../nrf/samples/nrf9160/spm/prj.conf

  • Yes , I did.

    But it is not working 

    You can see it non-secure in below print 

    Peripheral<HT> <HT> Domain<HT> <HT> Status<CR><LF>
    00 NRF_P0<HT> <HT> Non-Secure<HT> OK<CR><LF>
    01 NRF_CLOCK<HT> <HT> Non-Secure<HT> OK<CR><LF>
    02 NRF_RTC1<HT> <HT> Non-Secure<HT> OK<CR><LF>
    03 NRF_NVMC<HT> <HT> Non-Secure<HT> OK<CR><LF>
    04 NRF_UARTE1<HT> <HT> Non-Secure<HT> OK<CR><LF>
    05 NRF_UARTE2<HT> <HT> Non-Secure<HT> OK<CR><LF>
    06 NRF_IPC<HT> <HT> Non-Secure<HT> OK<CR><LF>
    07 NRF_VMC<HT> <HT> Non-Secure<HT> OK<CR><LF>
    08 NRF_FPU<HT> <HT> Non-Secure<HT> OK<CR><LF>
    09 NRF_EGU1<HT> <HT> Non-Secure<HT> OK<CR><LF>
    10 NRF_EGU2<HT> <HT> Non-Secure<HT> OK<CR><LF>
    11 NRF_TWIM2<HT> <HT> Non-Secure<HT> OK<CR><LF>
    12 NRF_SPIM3<HT> <HT> Non-Secure<HT> OK<CR><LF>
    13 NRF_TIMER0<HT> <HT> Non-Secure<HT> OK<CR><LF>
    14 NRF_TIMER1<HT> <HT> Non-Secure<HT> OK<CR><LF>
    15 NRF_TIMER2<HT> <HT> Non-Secure<HT> OK<CR><LF>
    16 NRF_SAADC<HT> <HT> Non-Secure<HT> OK<CR><LF>
    17 NRF_GPIOTE1<HT> <HT> Non-Secure<HT> OK<CR><LF>

    Regards,

    Smitesh Mali

Reply
  • Yes , I did.

    But it is not working 

    You can see it non-secure in below print 

    Peripheral<HT> <HT> Domain<HT> <HT> Status<CR><LF>
    00 NRF_P0<HT> <HT> Non-Secure<HT> OK<CR><LF>
    01 NRF_CLOCK<HT> <HT> Non-Secure<HT> OK<CR><LF>
    02 NRF_RTC1<HT> <HT> Non-Secure<HT> OK<CR><LF>
    03 NRF_NVMC<HT> <HT> Non-Secure<HT> OK<CR><LF>
    04 NRF_UARTE1<HT> <HT> Non-Secure<HT> OK<CR><LF>
    05 NRF_UARTE2<HT> <HT> Non-Secure<HT> OK<CR><LF>
    06 NRF_IPC<HT> <HT> Non-Secure<HT> OK<CR><LF>
    07 NRF_VMC<HT> <HT> Non-Secure<HT> OK<CR><LF>
    08 NRF_FPU<HT> <HT> Non-Secure<HT> OK<CR><LF>
    09 NRF_EGU1<HT> <HT> Non-Secure<HT> OK<CR><LF>
    10 NRF_EGU2<HT> <HT> Non-Secure<HT> OK<CR><LF>
    11 NRF_TWIM2<HT> <HT> Non-Secure<HT> OK<CR><LF>
    12 NRF_SPIM3<HT> <HT> Non-Secure<HT> OK<CR><LF>
    13 NRF_TIMER0<HT> <HT> Non-Secure<HT> OK<CR><LF>
    14 NRF_TIMER1<HT> <HT> Non-Secure<HT> OK<CR><LF>
    15 NRF_TIMER2<HT> <HT> Non-Secure<HT> OK<CR><LF>
    16 NRF_SAADC<HT> <HT> Non-Secure<HT> OK<CR><LF>
    17 NRF_GPIOTE1<HT> <HT> Non-Secure<HT> OK<CR><LF>

    Regards,

    Smitesh Mali

Children
No Data
Related