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

Is there a sample code for nRF52 SPI master without Soft device ?

I am trying to develop a simple SPI master for a custom nRF52832 uC, but I can't find anny sort of sample codes that don't use Soft devices for this task. I need the code to be simple, so no need for SD based codes. Is it possible or is the nordic SPI driver only usable through SD ?

Parents
  • The SPI driver code is independent of the softdevice. You can just take the code and use it without a softdevice and it will work fine. All the Nordic drivers are standalone and work with or without softdevices.

    If there are any places which use any sd_* functions at all, eg for configuring interrupts etc, there are a few files in the SDK with 'nosd' in their names which just provide trivial c implementations of those functions for simple source compatibility .. or you can just replace them with direct NVIC calls.

  • I am unable to create a project from scratch with the spi drivers and the necessary files. I tried to create a new project and added the nrf_drv_spi driver and all the associated driver and config files to the project run-time environment, but I still got those errors for just compiling

    Rebuild target 'Target 1' compiling main.c... assembling arm_startup_nrf52.s... compiling system_nrf52.c... compiling nrf_drv_common.c... compiling nrf_delay.c... C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.0.0-Beta4\CMSIS\Include\core_cm4.h(86): warning: #47-D: incompatible redefinition of macro "__WEAK" (declared at line 47 of "C:\Keil_v5\ARM\PACK\NordicSemiconductor\nRF_DeviceFamilyPack\8.6.1\Device\Include\compiler_abstraction.h") #define __WEAK attribute((weak)) C:\Keil_v5\ARM\PACK\NordicSemiconductor\nRF_Drivers\4.0.0-2.alpha\delay\nrf_delay.c: 1 warning, 0 errors compiling nrf_drv_spi.c... C:\Keil_v5\ARM\PACK\NordicSemiconductor\nRF_Drivers\4.0.0-2.alpha\spi_master\nrf_drv_spi.c(56): error: #35: #error directive: "Wrong configuration." #error "Wrong configuration." C:\Keil_v5\ARM\PACK\NordicSemiconductor\nRF_Drivers\4.0.0-2.alpha\spi_master\nrf_drv_spi.c: 0 warnings, 1 error compiling app_error.c... RTE\nRF_Libraries\nRF52832_xxAA\app_error.c(53): error: #29: expected an expression .line_num = line_num, RTE\nRF_Libraries\nRF52832_xxAA\app_error.c(54): error: #29: expected an expression .p_file_name = p_file_name, RTE\nRF_Libraries\nRF52832_xxAA\app_error.c(55): error: #29: expected an expression .err_code = error_code, RTE\nRF_Libraries\nRF52832_xxAA\app_error.c(67): error: #29: expected an expression .line_num = 0, RTE\nRF_Libraries\nRF52832_xxAA\app_error.c(68): error: #29: expected an expression .p_file_name = NULL, RTE\nRF_Libraries\nRF52832_xxAA\app_error.c(69): error: #29: expected an expression .err_code = error_code, RTE\nRF_Libraries\nRF52832_xxAA\app_error.c: 0 warnings, 6 errors compiling nrf_assert.c... ".\Objects\trial_3.axf" - 7 Error(s), 1 Warning(s). Target not created.

Reply
  • I am unable to create a project from scratch with the spi drivers and the necessary files. I tried to create a new project and added the nrf_drv_spi driver and all the associated driver and config files to the project run-time environment, but I still got those errors for just compiling

    Rebuild target 'Target 1' compiling main.c... assembling arm_startup_nrf52.s... compiling system_nrf52.c... compiling nrf_drv_common.c... compiling nrf_delay.c... C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.0.0-Beta4\CMSIS\Include\core_cm4.h(86): warning: #47-D: incompatible redefinition of macro "__WEAK" (declared at line 47 of "C:\Keil_v5\ARM\PACK\NordicSemiconductor\nRF_DeviceFamilyPack\8.6.1\Device\Include\compiler_abstraction.h") #define __WEAK attribute((weak)) C:\Keil_v5\ARM\PACK\NordicSemiconductor\nRF_Drivers\4.0.0-2.alpha\delay\nrf_delay.c: 1 warning, 0 errors compiling nrf_drv_spi.c... C:\Keil_v5\ARM\PACK\NordicSemiconductor\nRF_Drivers\4.0.0-2.alpha\spi_master\nrf_drv_spi.c(56): error: #35: #error directive: "Wrong configuration." #error "Wrong configuration." C:\Keil_v5\ARM\PACK\NordicSemiconductor\nRF_Drivers\4.0.0-2.alpha\spi_master\nrf_drv_spi.c: 0 warnings, 1 error compiling app_error.c... RTE\nRF_Libraries\nRF52832_xxAA\app_error.c(53): error: #29: expected an expression .line_num = line_num, RTE\nRF_Libraries\nRF52832_xxAA\app_error.c(54): error: #29: expected an expression .p_file_name = p_file_name, RTE\nRF_Libraries\nRF52832_xxAA\app_error.c(55): error: #29: expected an expression .err_code = error_code, RTE\nRF_Libraries\nRF52832_xxAA\app_error.c(67): error: #29: expected an expression .line_num = 0, RTE\nRF_Libraries\nRF52832_xxAA\app_error.c(68): error: #29: expected an expression .p_file_name = NULL, RTE\nRF_Libraries\nRF52832_xxAA\app_error.c(69): error: #29: expected an expression .err_code = error_code, RTE\nRF_Libraries\nRF52832_xxAA\app_error.c: 0 warnings, 6 errors compiling nrf_assert.c... ".\Objects\trial_3.axf" - 7 Error(s), 1 Warning(s). Target not created.

Children
No Data
Related