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

adding SPI to ble_app_uart

im using Feather EVM. im using the app_ble_uart . after i added SPI to the project i dont get any errors but the code does not run (goes to main) and when i press run it goes into hard fault.

the SPI is enabled. 

Parents
  • Feather EVM

    You mean this: https://www.adafruit.com/product/3406

    Have you tried using the SPI on its own - without BLE ?

    Have you used the debugger to see what's causing the Hard Fault?

    Have you enabled the debug logs for information on what's causing the crash?

  • You mean this: https://www.adafruit.com/product/3406 - yes

    Have you tried using the SPI on its own - without BLE ? - yes

    Have you used the debugger to see what's causing the Hard Fault? - im using IAR debugger

    Have you enabled the debug logs for information on what's causing the crash? - how do i do that ?

  • im using IAR debugger

    So what have you discovered by using it?

    Have you enabled the debug logs

    When you build the 'Debug' configuration, it should enable the logs.

    They may come out on the UART, or RTT

  • update : after testing the new SDK example of the app_ble_uart with the SPI i got it running (since nothing is connected to the Feather). after that i connected it to my board that has connection on all io's . after running the code it gets halt fault . i think it has something to do with the uart that needs IO's. i tried to disable it or change the uart tx/rx IO's to sothing else, but still no good.

    this is the log :

    Thu Jun 27, 2019 08:55:22: Loaded macro file: C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.2\arm\config\debugger\NordicSemi\nRF52.dmac
    Thu Jun 27, 2019 08:55:23: JLINK command: ProjectFile = D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\examples\ble_peripheral\ble_app_uart\pca10040\s132\iar\settings\ble_app_uart_pca10040_s132_nrf52832_xxaa.jlink, return = 0

    Thu Jun 27, 2019 08:55:23: Device "NRF52832_XXAA" selected.
    Thu Jun 27, 2019 08:55:23: DLL version: V6.44e, compiled Apr 5 2019 16:15:03

    Thu Jun 27, 2019 08:55:23: Firmware: J-Link V10 compiled Mar 21 2019 15:43:57

    Thu Jun 27, 2019 08:55:23: Selecting SWD as current target interface.

    Thu Jun 27, 2019 08:55:23: JTAG speed is initially set to: 1000 kHz
    Thu Jun 27, 2019 08:55:23: Found SW-DP with ID 0x2BA01477
    Thu Jun 27, 2019 08:55:23: Found SW-DP with ID 0x2BA01477
    Thu Jun 27, 2019 08:55:23: Scanning AP map to find all available APs
    Thu Jun 27, 2019 08:55:23: AP[2]: Stopped AP scan as end of AP map has been reached
    Thu Jun 27, 2019 08:55:23: AP[0]: AHB-AP (IDR: 0x24770011)
    Thu Jun 27, 2019 08:55:23: AP[1]: JTAG-AP (IDR: 0x02880000)
    Thu Jun 27, 2019 08:55:23: Iterating through AP map to find AHB-AP to use
    Thu Jun 27, 2019 08:55:23: AP[0]: Core found
    Thu Jun 27, 2019 08:55:23: AP[0]: AHB-AP ROM base: 0xE00FF000
    Thu Jun 27, 2019 08:55:23: CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
    Thu Jun 27, 2019 08:55:23: Found Cortex-M4 r0p1, Little endian.
    Thu Jun 27, 2019 08:55:23: FPUnit: 6 code (BP) slots and 2 literal slots
    Thu Jun 27, 2019 08:55:23: CoreSight components:
    Thu Jun 27, 2019 08:55:23: ROMTbl[0] @ E00FF000
    Thu Jun 27, 2019 08:55:23: ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
    Thu Jun 27, 2019 08:55:23: ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
    Thu Jun 27, 2019 08:55:23: ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
    Thu Jun 27, 2019 08:55:23: ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
    Thu Jun 27, 2019 08:55:23: ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
    Thu Jun 27, 2019 08:55:23: ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
    Thu Jun 27, 2019 08:55:23: Reset: Halt core after reset via DEMCR.VC_CORERESET.
    Thu Jun 27, 2019 08:55:23: Reset: Reset device via AIRCR.SYSRESETREQ.
    Thu Jun 27, 2019 08:55:23: Hardware reset with strategy 0 was performed
    Thu Jun 27, 2019 08:55:23: Initial reset was performed
    Thu Jun 27, 2019 08:55:27: J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (4096 bytes)
    Thu Jun 27, 2019 08:55:27: J-Link: Flash download: Total time needed: 0.151s (Prepare: 0.034s, Compare: 0.030s, Erase: 0.003s, Program: 0.078s, Verify: 0.000s, Restore: 0.004s)
    Thu Jun 27, 2019 08:55:27: 34024 bytes downloaded (8.57 Kbytes/sec)
    Thu Jun 27, 2019 08:55:27: Loaded debugee: D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\examples\ble_peripheral\ble_app_uart\pca10040\s132\iar\_build\ble_app_uart_pca10040_s132.out
    Thu Jun 27, 2019 08:55:27: Reset: Halt core after reset via DEMCR.VC_CORERESET.
    Thu Jun 27, 2019 08:55:27: Reset: Reset device via AIRCR.SYSRESETREQ.
    Thu Jun 27, 2019 08:55:27: Hardware reset with strategy 0 was performed
    Thu Jun 27, 2019 08:55:27: Target reset

  • Did you check the call-stack when debugging, to see what is running before the hardfault occurs? Do you have anything connected to the UART pins? If they are left floating, errors will be detected on the RX-line, which will result in an error code and leave the application in the error handler.

  • i have no need for physical uart pins, i only use it for the ble communication. i am trying to disable it with no success.call-stack is:
    app_error_fault_handler()
    app_error_handler_bare(uint32_t error_code = ?)
    uart_event_handle(app_uart_evt_t * p_event = ?)
    uart_event_handler(struct <Unnamed 41> * p_event = ?, void * p_context = ?)
    uart_evt_handler(nrfx_uart_event_t const * p_event = ?, void * p_context = ?)
    uarte_irq_handler(NRF_UARTE_Type * p_uarte = 0x40002000, uarte_control_block_t * p_cb = m_cb (0x20003DE0))
    <Exception frame>
    [nrfx_coredep_delay_us::delay_machine_code + 0]

Reply
  • i have no need for physical uart pins, i only use it for the ble communication. i am trying to disable it with no success.call-stack is:
    app_error_fault_handler()
    app_error_handler_bare(uint32_t error_code = ?)
    uart_event_handle(app_uart_evt_t * p_event = ?)
    uart_event_handler(struct <Unnamed 41> * p_event = ?, void * p_context = ?)
    uart_evt_handler(nrfx_uart_event_t const * p_event = ?, void * p_context = ?)
    uarte_irq_handler(NRF_UARTE_Type * p_uarte = 0x40002000, uarte_control_block_t * p_cb = m_cb (0x20003DE0))
    <Exception frame>
    [nrfx_coredep_delay_us::delay_machine_code + 0]

Children
  • This looks like it is caused by errors on the UART HW. Try commenting out/remove call to uart_init() in main, this is what initializes the UART peripheral. You will also have to remove calls to app_uart_put() in nus_data_handler(), as calling this when the app_uart library is not initialized will cause errors.

  • thaks

    i did it but now in nrf_drv_uart.h , im getting :

    Building configuration: ble_app_uart_pca10040_s132 - nrf52832_xxaa
    Updating build tree...
    app_uart_fifo.c
    Error[Pe020]: identifier "nrf_uarte_baudrate_t" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.h 122
    Error[Pe020]: identifier "nrf_uarte_error_mask_t" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.h 127
    Error[Pe020]: identifier "nrf_uarte_hwfc_t" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.h 130
    Error[Pe020]: identifier "nrf_uarte_parity_t" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.h 133
    Error[Pe020]: identifier "nrf_uarte_task_t" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.h 134
    Error[Pe020]: identifier "nrf_uarte_event_t" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.h 135
    Error[Pe020]: identifier "NRF_UARTE_PSEL_DISCONNECTED" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\components\libraries\uart\app_uart_fifo.c 151
    Error[Pe020]: identifier "NRF_UARTE_HWFC_DISABLED" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\components\libraries\uart\app_uart_fifo.c 154
    Error[Pe020]: identifier "NRF_UARTE_HWFC_ENABLED" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\components\libraries\uart\app_uart_fifo.c 154
    Error[Pe020]: identifier "NRF_UARTE_PARITY_INCLUDED" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\components\libraries\uart\app_uart_fifo.c 156
    Error[Pe020]: identifier "NRF_UARTE_PARITY_EXCLUDED" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\components\libraries\uart\app_uart_fifo.c 156
    Error while running C/C++ Compiler
    main.c
    nrf_drv_uart.c
    Error[Pe020]: identifier "nrf_uarte_baudrate_t" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.h 122
    Error[Pe020]: identifier "nrf_uarte_error_mask_t" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.h 127
    Error[Pe020]: identifier "nrf_uarte_hwfc_t" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.h 130
    Error[Pe020]: identifier "nrf_uarte_parity_t" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.h 133
    Error[Pe020]: identifier "nrf_uarte_task_t" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.h 134
    Error[Pe020]: identifier "nrf_uarte_event_t" is undefined D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.h 135
    Error[Pe550]: variable "config" was set but never used D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.c 124
    Error[Pe550]: variable "m_handlers" was set but never used D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.c 49
    Error[Pe550]: variable "m_contexts" was set but never used D:\Documents\Projects\work facilitation\Miter sow\C ble_app org + spi\integration\nrfx\legacy\nrf_drv_uart.c 50
    Error while running C/C++ Compiler

    Total number of errors: 20
    Total number of warnings: 0

  • You must have made more changes than the ones I suggested to get those errors. Did you modify sdk_config.h or remove some includes/source files?

  • thank you. after clearing all the errors its working.

Related