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

Combining TWI_scanner and UART examples

I am currently trying to combine the TWI_scanner and UART examples from PCA10028 into one example program. I am copying over code from one main.c file into the other. 

So I am combining the two main.c files into one main.c file but I get compile errors when I try running the combined code.  Is there any recommendation on the best way to combine the TWI_scanner + UART examples then? Or perhaps I forgot to copy over some other files that are needed for both example programs to work?

I noticed that the original TWI_scanner program uses a nrf_drv_uart.c in the nRF_drivers folder. Does that mean that the original TWI scanner program already has UART capability?

I am using Keil 5 and SDK version 12. 

Parents
  • Hello,

    The best approach is typically to copy what you need from one of the projects over to the other, and then start to fix compiler errors (include files that are needed).

    What compiler errors do you get? I guess it starts with missing .h-files. When you have included all these (included the folders that they are found in), it is probably complaining about some functions that are not defined. This is because it misses the .c files. Look in the example that you copied from what files that these are defined in, and include these .c files in your project. If it still complains about the function when you have included the file it is probably guarded by an #if.

    If you look at the nrf_drv_uart.c file, it says on line 13:

    #if UART_ENABLED

    This means that this is only included if UART_ENABLED is defined to 1 in sdk_config.h, so look for these guards.

    What compiler errors are you currently facing?

    Best regards,

    Edvin

  • Hi Edvin,

    I have modified the TWI scanner project's sdk_config.h for adding APP_UART_ENABLED and RETARGET. I am getting 3 errors that the APP_UART_INIT, APP_UART_GET, and APP_UART_PUT are not found. I did also modify the include path, but I will double check. 

    I just noticed the arm_startup_nrf51.s files are different between projects. Will I have to modify/fix that file too?

  • Update: I managed to figure it out and did not need to modify the arm_startup_nrf51.s file. 

Reply Children
No Data
Related