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 Reply Children
  • Hi,

    I downloaded "1.0.0" sdk and added "UART_2" related code to "http_application_update" project.

    In this firmware i am not getting any hard fault error but also not getting "printk" print on the pc. 

    So not being able to know whether application is running or not and UART 2 is working or not. 

    Following are the print on the pc 

    7/30/2019 17:16:33.467 [RX] - ***** Booting Zephyr OS v1.14.99-ncs2 *****<CR><LF>
    [00:00:00.004,455] <ESC>[0m<inf> mcuboot: Starting bootloader<ESC>[0m<CR><LF>
    [00:00:00.012,908] <ESC>[0m<inf> mcuboot: Primary image: magic=unset, copy_done=0x3, image_ok=0x1<ESC>[0m<CR><LF>
    [00:00:00.024,169] <ESC>[0m<inf> mcuboot: Scratch: magic=unset, copy_done=0x50, image_ok=0x3<ESC>[0m<CR><LF>
    [00:00:00.034,851] <ESC>[0m<inf> mcuboot: Boot source: primary slot<ESC>[0m<CR><LF>
    [00:00:00.045,959] <ESC>[0m<inf> mcuboot: Swap type: none<ESC>[0m<CR><LF>
    [00:00:00.385,467] <ESC>[0m<inf> mcuboot: Bootloader chainload address offset: 0xc000<ESC>[0m<CR><LF>
    [00:00:00.395,355] <ESC>[0m<inf> mcuboot: Jumping to the first image slot<ESC>[0m<CR><LF>
    ***** Booting Zephyr OS v1.14.99-ncs2 *****<CR><LF>
    Flash region<HT> <HT> Domain<HT> <HT> Permissions<CR><LF>
    00 0x00000 0x08000 <HT> Secure<HT> <HT> rwxl<CR><LF>
    01 0x08000 0x10000 <HT> Secure<HT> <HT> rwxl<CR><LF>
    02 0x10000 0x18000 <HT> Secure<HT> <HT> rwxl<CR><LF>
    03 0x18000 0x20000 <HT> Non-Secure<HT> rwxl<CR><LF>
    04 0x20000 0x28000 <HT> Non-Secure<HT> rwxl<CR><LF>
    05 0x28000 0x30000 <HT> Non-Secure<HT> rwxl<CR><LF>
    06 0x30000 0x38000 <HT> Non-Secure<HT> rwxl<CR><LF>
    07 0x38000 0x40000 <HT> Non-Secure<HT> rwxl<CR><LF>
    08 0x40000 0x48000 <HT> Non-Secure<HT> rwxl<CR><LF>
    09 0x48000 0x50000 <HT> Non-Secure<HT> rwxl<CR><LF>
    10 0x50000 0x58000 <HT> Non-Secure<HT> rwxl<CR><LF>
    11 0x58000 0x60000 <HT> Non-Secure<HT> rwxl<CR><LF>
    12 0x60000 0x68000 <HT> Non-Secure<HT> rwxl<CR><LF>
    13 0x68000 0x70000 <HT> Non-Secure<HT> rwxl<CR><LF>
    14 0x70000 0x78000 <HT> Non-Secure<HT> rwxl<CR><LF>
    15 0x78000 0x80000 <HT> Non-Secure<HT> rwxl<CR><LF>
    16 0x80000 0x88000 <HT> Non-Secure<HT> rwxl<CR><LF>
    17 0x88000 0x90000 <HT> Non-Secure<HT> rwxl<CR><LF>
    18 0x90000 0x98000 <HT> Non-Secure<HT> rwxl<CR><LF>
    19 0x98000 0xa0000 <HT> Non-Secure<HT> rwxl<CR><LF>
    20 0xa0000 0xa8000 <HT> Non-Secure<HT> rwxl<CR><LF>
    21 0xa8000 0xb0000 <HT> Non-Secure<HT> rwxl<CR><LF>
    22 0xb0000 0xb8000 <HT> Non-Secure<HT> rwxl<CR><LF>
    23 0xb8000 0xc0000 <HT> Non-Secure<HT> rwxl<CR><LF>
    24 0xc0000 0xc8000 <HT> Non-Secure<HT> rwxl<CR><LF>
    25 0xc8000 0xd0000 <HT> Non-Secure<HT> rwxl<CR><LF>
    26 0xd0000 0xd8000 <HT> Non-Secure<HT> rwxl<CR><LF>
    27 0xd8000 0xe0000 <HT> Non-Secure<HT> rwxl<CR><LF>
    28 0xe0000 0xe8000 <HT> Non-Secure<HT> rwxl<CR><LF>
    29 0xe8000 0xf0000 <HT> Non-Secure<HT> rwxl<CR><LF>
    30 0xf0000 0xf8000 <HT> Non-Secure<HT> rwxl<CR><LF>
    31 0xf8000 0x100000 <HT> Non-Secure<HT> rwxl<CR><LF>
    Non-secure callable region 0 placed in flash region 2 with size 32.<CR><LF>
    <CR><LF>
    <CR><LF>
    SRAM region<HT> <HT> Domain<HT> <HT> Permissions<CR><LF>
    00 0x00000 0x02000<HT> Secure<HT> <HT> rwxl<CR><LF>
    01 0x02000 0x04000<HT> Secure<HT> <HT> rwxl<CR><LF>
    02 0x04000 0x06000<HT> Secure<HT> <HT> rwxl<CR><LF>
    03 0x06000 0x08000<HT> Secure<HT> <HT> rwxl<CR><LF>
    04 0x08000 0x0a000<HT> Secure<HT> <HT> rwxl<CR><LF>
    05 0x0a000 0x0c000<HT> Secure<HT> <HT> rwxl<CR><LF>
    06 0x0c000 0x0e000<HT> Secure<HT> <HT> rwxl<CR><LF>
    07 0x0e000 0x10000<HT> Secure<HT> <HT> rwxl<CR><LF>
    08 0x10000 0x12000<HT> Non-Secure<HT> rwxl<CR><LF>
    09 0x12000 0x14000<HT> Non-Secure<HT> rwxl<CR><LF>
    10 0x14000 0x16000<HT> Non-Secure<HT> rwxl<CR><LF>
    11 0x16000 0x18000<HT> Non-Secure<HT> rwxl<CR><LF>
    12 0x18000 0x1a000<HT> Non-Secure<HT> rwxl<CR><LF>
    13 0x1a000 0x1c000<HT> Non-Secure<HT> rwxl<CR><LF>
    14 0x1c000 0x1e000<HT> Non-Secure<HT> rwxl<CR><LF>
    15 0x1e000 0x20000<HT> Non-Secure<HT> rwxl<CR><LF>
    16 0x20000 0x22000<HT> Non-Secure<HT> rwxl<CR><LF>
    17 0x22000 0x24000<HT> Non-Secure<HT> rwxl<CR><LF>
    18 0x24000 0x26000<HT> Non-Secure<HT> rwxl<CR><LF>
    19 0x26000 0x28000<HT> Non-Secure<HT> rwxl<CR><LF>
    20 0x28000 0x2a000<HT> Non-Secure<HT> rwxl<CR><LF>
    21 0x2a000 0x2c000<HT> Non-Secure<HT> rwxl<CR><LF>
    22 0x2c000 0x2e000<HT> Non-Secure<HT> rwxl<CR><LF>
    23 0x2e000 0x30000<HT> Non-Secure<HT> rwxl<CR><LF>
    24 0x30000 0x32000<HT> Non-Secure<HT> rwxl<CR><LF>
    25 0x32000 0x34000<HT> Non-Secure<HT> rwxl<CR><LF>
    26 0x34000 0x36000<HT> Non-Secure<HT> rwxl<CR><LF>
    27 0x36000 0x38000<HT> Non-Secure<HT> rwxl<CR><LF>
    28 0x38000 0x3a000<HT> Non-Secure<HT> rwxl<CR><LF>
    29 0x3a000 0x3c000<HT> Non-Secure<HT> rwxl<CR><LF>
    30 0x3c000 0x3e000<HT> Non-Secure<HT> rwxl<CR><LF>
    31 0x3e000 0x40000<HT> Non-Secure<HT> rwxl<CR><LF>
    <CR><LF>
    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> Secure<HT> <HT> SKIP<CR><LF>
    06 NRF_TWIM2<HT> <HT> Non-Secure<HT> OK<CR><LF>
    07 NRF_SPIM3<HT> <HT> Non-Secure<HT> OK<CR><LF>
    08 NRF_TIMER0<HT> <HT> Non-Secure<HT> OK<CR><LF>
    09 NRF_TIMER1<HT> <HT> Non-Secure<HT> OK<CR><LF>
    10 NRF_TIMER2<HT> <HT> Non-Secure<HT> OK<CR><LF>
    11 NRF_SAADC<HT> <HT> Non-Secure<HT> OK<CR><LF>
    12 NRF_PWM0<HT> <HT> Non-Secure<HT> OK<CR><LF>
    13 NRF_PWM1<HT> <HT> Non-Secure<HT> OK<CR><LF>
    14 NRF_PWM2<HT> <HT> Non-Secure<HT> OK<CR><LF>
    15 NRF_PWM3<HT> <HT> Non-Secure<HT> OK<CR><LF>
    16 NRF_IPC<HT> <HT> Non-Secure<HT> OK<CR><LF>
    17 NRF_VMC<HT> <HT> Non-Secure<HT> OK<CR><LF>
    18 NRF_FPU<HT> <HT> Non-Secure<HT> OK<CR><LF>
    19 NRF_EGU1<HT> <HT> Non-Secure<HT> OK<CR><LF>
    20 NRF_EGU2<HT> <HT> Non-Secure<HT> OK<CR><LF>
    21 NRF_GPIOTE1<HT> <HT> Non-Secure<HT> OK<CR><LF>
    <CR><LF>
    SPM: NS image at 0x18200<CR><LF>
    SPM: NS MSP at 0x20026ce0<CR><LF>
    SPM: NS reset vector at 0x1b205<CR><LF>
    SPM: prepare to jump to Non-Secure image.<CR><LF>
    ***** Booting Zephyr OS v1.14.99-ncs2 *****<CR><LF>

    Regards,

    Smitesh Mali

  • Hi,

    do you get "printk" data on pc in 1.0.0 sdk and UART2 is working or not ?

    Regards,

    Smitesh Mali

  • I get output from printk, and I am able to transmit data and register an IRQ on UART2.

    The application tries to establish an LTE connection before it outputs anything.

    Can you try to disable the automatic connection, just to see if getting the connection takes longer time than you have been waiting for output (it might take several minutes).

    In your prj.conf file, one of the lines should say

    CONFIG_LTE_AUTO_INIT_AND_CONNECT=y

    Please try to change the "y" to "n," and see if you get a line saying "Press Button 1 to start the FOTA download" in your terminal.

    P.S.

    Remember to turn the config on again afterwards, so that you are able to get an internet connection

  • Hi,

    Making "CONFIG_LTE_AUTO_INIT_AND_CONNECT=n" solved the issue.

    Now printk and UART2 both are working

    Regards,

    Smitesh Mali

Related