Link Failures Converting Project from nRF52810 to nRF52832: twi and uart

Hello I have developed a project that was initially based on the nRF52810 for an Indoor Air Quality Data Logger(IAQ-LOGR) which monitors Ambient Light, Temperature, Humidity, and CO2 and has a mobile app that works with the IAQ-LOGR which is a specific application of the more general SENSR-LOGR platform which is a hardware platform that acts as an Arduino shield to plug into the nRF52 DK platforms and has multiple locations where standardized I2C and SPI sensors and memory along with USB-UART, Power Management, various batteries and a RF plugin slot for RF devices if the smWSP-ARD was to act as a standalone platform.  That being said the original application was developed for a small code size, low cost nRF52810 in which I am working to expand the SENSR-LOGR firmware which will be released as an open source firmware platform to include other variants such as the nRF52832 and the nRF52840.  

In copying the nRF52810 project to a nRF52832 project I have the project where it compiles but I am running into a few linker errors that are tripping us up along the way to getting this released to the public.  In tracking these errors down and comparing them to the nRF52810 project which has been working fine for some time now it appears these errors are being cause by some additional header files that are getting included in the nRF52832 version that are causing some re-definements of some functions related to the twi and uart functions in particular with the following functions shown below...

More specifically for the UART issues a header file, nrfx_uart.h, is getting pulled into the project and the nrfx_twi.h header files are getting included in the nRF52832 build whereas only the nrf_drv_uart.h and nrf_drv_tw.h are getting pulled into the nRF52810 project and the nrfx header files are what are causing the issues.  I have tried various configurations in the sdk_config.h files and have had no success resolving these issue.  Hoping you can lend some insight as to how to resolve these issues.

FYI - We will also be releasing a Zephyr version of this firmware SENSR-LOGR platform also expected to be completed towards the end of February. 

Thanks in Advance!!

Regards,

Sensor Maestros

  • Hi Sensor,

    It seems the error is typically caused by issues with the paths to .c and .h files in your project.

    You may find the following discussion helpful for resolving the issue:

    (62) Li005 Error IAR - Nordic Q&A - Nordic DevZone - Nordic DevZone

    (62) IAR linker Error[Li005] - Nordic Q&A - Nordic DevZone - Nordic DevZone

    Please verify that all file paths are correctly configured and accessible in your project settings. If the issue persists, let me know, and I’ll assist further.

    Best regards,

    Charlie

  • Hi Charlie,

     Yes I have confirmed all paths to both source and header files are valid that was one of the first things I did ;-)  The clue comes from there are additional nrfx header files in the nRF52832 project that are getting pulled in that are NOT being pulled in on the nRF52810 project.  These 2 files are nrfx_twi.h and nrfx_uart.h along with the nrf_drv_twi.h and nrf_drv_uart.h files which are changing the way various functions related to the twi and uart peripherals are defined/compiled. 

    As an example if we take one of the uart errors such as the "no definition for "nrfx_uart_init" in nrf_drv_uart.c or more specifically the object file being nrf_drv_uart.o as shown below.

    Error[Li005]: no definition for "nrfx_uart_init" [referenced from C:\Projects_Working\SMSTRS_Apps\smSENSR-LOGR-v4.3_munge\
    Projects\nRF52832\IAR\smSENSR-LOGR\project\Debug\Obj\nrf_drv_uart.o]

    nrfx_uart_init() => is referenced in the nrf_drv_uart.h file via a #define and is set to 0.  The nrfx_uart.h(NOT being pulled into the nRF52810 build) file is also pulled into the build in the nrf_drv_uart.h file due to the compiler optoin 'NRF_DRV_WITH_UART' which gets defined earlier in this header file due to statement shown just below...

    #if defined(UART_PRESENT) && NRFX_CHECK(NRFX_UART_ENABLED)
    #define NRF_DRV_UART_WITH_UART
    #endif

    The compiler Option 'UART_PRESENT' is set in the nRF52832_peripherals.h for which this header file does NOT exist in the nRF52810 build and in fact if I search the entire nRF52810 project I don't find any #define for the UART_PRESENT?  

    IF I comment out the 2 lines in the nRF52832_peripherals.h file the link errors go away which is good BUT I am not understanding what the correlative file for the nRF52810 would be?  I.E. - Shouldn't these same #defines shown below also be defined in say a nRF52810_peripherals.h file?

    /* Universal Asynchronous Receiver-Transmitter */
    //#define UART_PRESENT
    //#define UART_COUNT 1

    For the nrfx_twi_xfer, nrfx_twi_enable, nrfx_twi_init, and nrfx_twi_uninit "no definition" issues I was also able to resolve this by commenting out the following lines in the nRF52832_peripherals.h file...

    /* Two Wire Interface Master */
    //#define TWI_PRESENT
    //#define TWI_COUNT 2

    Still unclear as to why there are not similar defines in the nRF52810 build with a similar header file like nRF52810_peripherals.h ?

    So now I am down to one last error where the 'SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler' is being defined in 2 different locations once in nrfx_spim.o and the second in the nrfx_twim.o compiled files.  Doing a complete project search appears this can be defined in both the nRF51_to_nRF52.h file and then also in the nrfx_irqs_nrf52832.h header files...any ideas which file should take precedence for the definition for SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler

    Regards,

    Frank

  • TWIM0 and SPIM0 use different instances on the nRF52810 compared with the same instance on the nRF52832, so must change (say) SPIM0 to SPIM1 to use physically different peripheral (ie. can't use both TWIM0 and SPIM0 on nRF52832)

    Shared Id nRF52811
    3 0x40003000 TWI TWI0 Two-wire interface master Deprecated
    3 0x40003000 TWIM TWIM0 Two-wire interface master
    3 0x40003000 TWIS TWIS0 Two-wire interface slave
    4 0x40004000 SPI SPI0 SPI master Deprecated
    4 0x40004000 SPIM SPIM0 SPI master
    4 0x40004000 SPIS SPIS0 SPI slave
    
    Shared Id nRF52832
    ID 3 (0x40003000) SPIM SPIS SPI TWIM TWIS TWI
    ID 4 (0x40004000) SPIM SPIS SPI TWIM TWIS TWI
    ID 35 (0x40023000) SPIM SPIS SPI
    

  • Yes re-assigning the TWIM0 to TWIM1 resolved the last compile/link issue.  Project now builds/compiles. 

    Thanks

    Frank

Related