This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

want nrf24l01 communication with nrf51822

hello,will you please tell me which code i have to use in the sdk 12.2.0 for rf communication with nrf51822 and nrf24l01 .and also tell me which settings i have to do for nrf24l01 side as a transmitter.so that i can receive data on nrf51822 side.

  • Hi Pallavi

    You should be able to find the project here
    Please note that it has only been tested on the nRF52DK. I only confirmed that it compiled on the nRF51DK, but didn't have time to test it.
    The pins used for the nRF24L01+ module is 11, 12, 13, 14, 15, 16, which corresponds to CE, CSN, SCK, MOSI, MISO, IRQ (in that order).

    Best regards

  • hello sir, thank you for the code but i am not getting how can i use this code for the rf communication. on one side i am using the arduio with nrf24l01 through SPI.and i am looking for the code on arduino platform so that i can easily communicate with nrf51.the code here you had given on keil platform.thats why i am confused now.i am not getting what can i do now.but thank you for your code. Pallavi

  • Hi Pallavi
    You can use the attached code to verify that the nRF24L01 module is working correctly, and is able to communicate with your nRF51 kit (you just need a separate nRF51 kit to run the nRF24L01).
    You can also use it to compare the register values and the control signals for the nRF24L01 module, and see how they differ from your Arduino implementation.
    With that information in place it would hopefully be easier for you to see what is wrong on the Arduino side (assuming of course your L01 module works fine).
    Since I don't have your hardware I can't really test that on my side.

    Best regards

  • sir, i at one point i am succesful for achieving communication between nrf51822 and nrf24l01.but there is one problem i am facing now i am receiving interrupt from nrf24l01 but at the receiver end i am not getting any data. for which i had used the code from sdk 12.2.0 from the folder examples/peripherals/radio in this code the settings given for nrf24 series, these are as follows, uint8_t tx_address[5] = { 0xC0, 0x01, 0x23, 0x45, 0x67 };

    • hal_nrf_set_rf_channel(7);
    • hal_nrf_set_address_width(HAL_NRF_AW_5BYTES);
    • hal_nrf_set_address(HAL_NRF_TX, tx_address);
    • hal_nrf_set_address(HAL_NRF_PIPE0, tx_address);
    • hal_nrf_open_pipe(0, false);
    • hal_nrf_set_datarate(HAL_NRF_1MBPS);
    • hal_nrf_set_crc_mode(HAL_NRF_CRC_16BIT);
    • hal_nrf_setup_dynamic_payload(0xFF);
    • hal_nrf_enable_dynamic_payload(false);
    • @endverbatim
    • When transmitting packets with hal_nrf_write_tx_payload(const uint8_t *tx_pload, uint8_t length),
    • match the length with PACKET_STATIC_LENGTH.
    • hal_nrf_write_tx_payload(payload, PACKET_STATIC_LENGTH); according to this i had programmed arduino board with the following settings, const byte rxAddr[5]={0xC0,0x01,0x23,0x45,0x67}; radio.setDataRate(RF24_1MBPS); radio.setChannel(7); // radio.setRetries(15,15); radio.setCRCLength(RF24_CRC_16); radio.openWritingPipe(rxAddr); radio.stopListening(); and for the payload length making equal i had chaned the arduino library function and made payload width 1. at one point i had received the data from nrf24l01.but when next time i started to code arduino board and nrf51822 my rf communuication fail.i dont know how this happened. will you please help me in one thing because now i am thinking reversly i am trying to change opayload width of nrf51822 .will you please help me how to change the payload width with 32 bytes.cz nrf24l01 has default payload width of 32 bytes. so please tell me what changes i have to do for changing payload widgth of nrf51822 according to receing 32 bytes data. Pallavi
  • hello sir, i have compiled your code in C:\nRF5_SDK_12.2.0_f012efa\examples\proprietary_rf\l01_test_app\esb_ptx\pca10028\blank\arm5_no_packs folder but it is showing errors.and you told that you have compiled this code in the nrf51 DK.but in my case it is not getting compiled.will you please tell me the path i have followed to locate this code right or wrong.if wrong path then may be it is showing that errors the errors are as,

    ..............\components\drivers_nrf\uart\nrf_drv_uart.c: 13 warnings, 30 errors compiling app_uart_fifo.c... compiling retarget.c... compiling app_fifo.c... compiling app_error.c... compiling app_error_weak.c... ..............\components\libraries\log\src\nrf_log_ctrl_internal.h(26): error: #260-D: explicit type is missing ("int" assumed) nrf_log_init(timestamp_func) ..............\components\libraries\log\src\nrf_log_ctrl_internal.h(26): warning: #1294-D: Old-style function nrf_log_init nrf_log_init(timestamp_func) ..............\components\libraries\log\nrf_log_ctrl.h(35): warning: #99-D: a declaration here must declare a parameter typedef uint32_t (*nrf_log_timestamp_func_t)(void); ..............\components\libraries\log\nrf_log_ctrl.h(35): warning: #231-D: declaration is not visible outside of function typedef uint32_t (*nrf_log_timestamp_func_t)(void); ..............\components\libraries\log\nrf_log_ctrl.h(99): warning: #99-D: a declaration here must declare a parameter typedef bool (*nrf_log_std_handler_t)( ..............\components\libraries\log\nrf_log_ctrl.h(99): warning: #231-D: declaration is not visible outside of function typedef bool (*nrf_log_std_handler_t)( ..............\components\libraries\log\nrf_log_ctrl.h(125): warning: #99-D: a declaration here must declare a parameter typedef uint32_t (*nrf_log_hexdump_handler_t)( ..............\components\libraries\log\nrf_log_ctrl.h(125): warning: #231-D: declaration is not visible outside of function typedef uint32_t (*nrf_log_hexdump_handler_t)( ..............\components\libraries\log\nrf_log_ctrl.h(148): error: #99: a declaration here must declare a parameter ret_code_t nrf_log_init(nrf_log_timestamp_func_t timestamp_func); ..............\components\libraries\log\nrf_log_ctrl.h(153): error: #99: a declaration here must declare a parameter ret_code_t nrf_log_blocking_backend_set(void); ..............\components\libraries\log\nrf_log_ctrl.h(169): error: #99: a declaration here must declare a parameter void nrf_log_frontend_init(nrf_log_std_handler_t std_handler, ..............\components\libraries\log\nrf_log_ctrl.h(182): error: #99: a declaration here must declare a parameter void nrf_log_handlers_set(nrf_log_std_handler_t std_handler, ..............\components\libraries\log\nrf_log_ctrl.h(194): error: #99: a declaration here must declare a parameter

    ool nrf_log_frontend_dequeue(void); ..............\components\libraries\util\app_error_weak.c(24): warning: #85-D: invalid storage class for a parameter

    _WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info) ..............\components\libraries\util\app_error_weak.c(24): error: #99: a declaration here must declare a parameter __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info) ..............\components\libraries\util\app_error_weak.c(25): error: #65: expected a ";" { ..............\components\libraries\util\app_error_weak.c(38): warning: At end of source: #12-D: parsing restarts here after previous syntax error ..............\components\libraries\log\src\nrf_log_ctrl_internal.h(26): warning: #1079-D: standard requires that parameter "timestamp_func" be given a type by a subsequent declaration ("int" assumed) nrf_log_init(timestamp_func) ..............\components\libraries\util\app_error_weak.c(38): error: At end of source: #130: expected a "{" ..............\components\libraries\util\app_error_weak.c(38): error: At end of source: #67: expected a "}" ..............\components\libraries\util\app_error_weak.c: 10 warnings, 10 errors compiling app_util_platform.c... compiling nrf_log_backend_serial.c... ..............\components\libraries\log\src\nrf_log_ctrl_internal.h(26): error: #260-D: explicit type is missing ("int" assumed) nrf_log_init(timestamp_func) ..............\components\libraries\log\src\nrf_log_ctrl_internal.h(26): warning: #1294-D: Old-style function nrf_log_init nrf_log_init(timestamp_func) ..............\components\libraries\log\nrf_log_ctrl.h(35): warning: #99-D: a declaration here must declare a parameter typedef uint32_t (*nrf_log_timestamp_func_t)(void); ..............\components\libraries\log\nrf_log_ctrl.h(35): warning: #231-D: declaration is not visible outside of function typedef uint32_t (*nrf_log_timestamp_func_t)(void); ..............\components\libraries\log\nrf_log_ctrl.h(99): warning: #99-D: a declaration here must declare a parameter typedef bool (*nrf_log_std_handler_t)( ..............\components\libraries\log\nrf_log_ctrl.h(99): warning: #231-D: declaration is not visible outside of function typedef bool (*nrf_log_std_handler_t)( ..............\components\libraries\log\nrf_log_ctrl.h(125): warning: #99-D: a declaration here must declare a parameter typedef uint32_t (*nrf_log_hexdump_handler_t)( ..............\components\libraries\log\nrf_log_ctrl.h(125): warning: #231-D: declaration is not visible outside of function typedef uint32_t (*nrf_log_hexdump_handler_t)( ..............\components\libraries\log\nrf_log_ctrl.h(148): error: #99: a declaration here must declare a parameter ret_code_t nrf_log_init(nrf_log_timestamp_func_t timestamp_func); ..............\components\libraries\log\nrf_log_ctrl.h(153): error: #99: a declaration here must declare a parameter ret_code_t nrf_log_blocking_backend_set(void); ..............\components\libraries\log\nrf_log_ctrl.h(169): error: #99: a declaration here must declare a parameter void nrf_log_frontend_init(nrf_log_std_handler_t std_handler, ..............\components\libraries\log\nrf_log_ctrl.h(182): error: #99: a declaration here must declare a parameter void nrf_log_handlers_set(nrf_log_std_handler_t std_handler, ..............\components\libraries\log\nrf_log_ctrl.h(194): error: #99: a declaration here must declare a parameter

    ool nrf_log_frontend_dequeue(void); ..............\components\libraries\log\nrf_log_backend.h(38): error: #99: a declaration here must declare a parameter ret_code_t nrf_log_backend_init( ool blocking); ..............\components\libraries\log\nrf_log_backend.h(46): error: #99: a declaration here must declare a parameter nrf_log_std_handler_t nrf_log_backend_std_handler_get(void); ..............\components\libraries\log\nrf_log_backend.h(54): error: #99: a declaration here must declare a parameter nrf_log_hexdump_handler_t nrf_log_backend_hexdump_handler_get(void); ..............\components\libraries\log\nrf_log_backend.h(61): error: #99: a declaration here must declare a parameter uint8_t nrf_log_backend_getchar(void); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(134): error: #85: invalid storage class for a parameter extern ARMABI_PURE unsigned char **__rt_ctype_table(void); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(134): error: #99: a declaration here must declare a parameter extern ARMABI_PURE unsigned char **__rt_ctype_table(void); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(134): error: #3108: attribute "__nothrow" does not apply here extern ARMABI_PURE unsigned char **__rt_ctype_table(void); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(142): error: #85: invalid storage class for a parameter extern int (isalnum)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(142): error: #99: a declaration here must declare a parameter extern int (isalnum)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(150): error: #85: invalid storage class for a parameter extern int (isalpha)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(150): error: #99: a declaration here must declare a parameter extern int (isalpha)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(158): error: #85: invalid storage class for a parameter extern int (iscntrl)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(158): error: #99: a declaration here must declare a parameter extern int (iscntrl)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(168): error: #85: invalid storage class for a parameter extern int (isdigit)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(168): error: #99: a declaration here must declare a parameter extern int (isdigit)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(172): error: #85: invalid storage class for a parameter extern int (isblank)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(172): error: #99: a declaration here must declare a parameter extern int (isblank)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(181): error: #85: invalid storage class for a parameter extern int (isgraph)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(181): error: #99: a declaration here must declare a parameter extern int (isgraph)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(189): error: #85: invalid storage class for a parameter extern int (islower)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(189): error: #99: a declaration here must declare a parameter extern int (islower)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(197): error: #85: invalid storage class for a parameter extern int (isprint)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(197): error: #99: a declaration here must declare a parameter extern int (isprint)(int /c/); C:\Keil_v5\ARM\ARMCC\Bin..\include\ctype.h(206): error: #85: invalid storage class for a parameter extern int (ispunct)(int /c/); ..............\components\libraries\log\src\nrf_log_backend_serial.c: 7 warnings, 30 errors compiling nrf_log_frontend.c... ..............\components\libraries\log\src\nrf_log_ctrl_internal.h(26): error: #260-D: explicit type is missing ("int" assumed) nrf_log_init(timestamp_func) ..............\components\libraries\log\src\nrf_log_ctrl_internal.h(26): warning: #1294-D: Old-style function nrf_log_init nrf_log_init(timestamp_func) ..............\components\libraries\log\nrf_log_ctrl.h(35): warning: #99-D: a declaration here must declare a parameter typedef uint32_t (*nrf_log_timestamp_func_t)(void); ..............\components\libraries\log\nrf_log_ctrl.h(35): warning: #231-D: declaration is not visible outside of function typedef uint32_t (*nrf_log_timestamp_func_t)(void); ..............\components\libraries\log\nrf_log_ctrl.h(99): warning: #99-D: a declaration here must declare a parameter typedef bool (*nrf_log_std_handler_t)( ..............\components\libraries\log\nrf_log_ctrl.h(99): warning: #231-D: declaration is not visible outside of function typedef bool (*nrf_log_std_handler_t)( ..............\components\libraries\log\nrf_log_ctrl.h(125): warning: #99-D: a declaration here must declare a parameter typedef uint32_t (*nrf_log_hexdump_handler_t)( ..............\components\libraries\log\nrf_log_ctrl.h(125): warning: #231-D: declaration is not visible outside of function typedef uint32_t (*nrf_log_hexdump_handler_t)( ..............\components\libraries\log\nrf_log_ctrl.h(148): error: #99: a declaration here must declare a parameter ret_code_t nrf_log_init(nrf_log_timestamp_func_t timestamp_func); ..............\components\libraries\log\nrf_log_ctrl.h(153): error: #99: a declaration here must declare a parameter ret_code_t nrf_log_blocking_backend_set(void); ..............\components\libraries\log\nrf_log_ctrl.h(169): error: #99: a declaration here must declare a parameter void nrf_log_frontend_init(nrf_log_std_handler_t std_handler, ..............\components\libraries\log\nrf_log_ctrl.h(182): error: #99: a declaration here must declare a parameter void nrf_log_handlers_set(nrf_log_std_handler_t std_handler, ..............\components\libraries\log\nrf_log_ctrl.h(194): error: #99: a declaration here must declare a parameter

    ool nrf_log_frontend_dequeue(void); ..............\components\libraries\log\nrf_log_backend.h(38): error: #99: a declaration here must declare a parameter ret_code_t nrf_log_backend_init( ool blocking); ..............\components\libraries\log\nrf_log_backend.h(46): error: #99: a declaration here must declare a parameter nrf_log_std_handler_t nrf_log_backend_std_handler_get(void); ..............\components\libraries\log\nrf_log_backend.h(54): error: #99: a declaration here must declare a parameter nrf_log_hexdump_handler_t nrf_log_backend_hexdump_handler_get(void); ..............\components\libraries\log\nrf_log_backend.h(61): error: #99: a declaration here must declare a parameter uint8_t nrf_log_backend_getchar(void); ..............\components\libraries\log\src\nrf_log_frontend.c(36): warning: #99-D: a declaration here must declare a parameter typedef struct ..............\components\libraries\log\src\nrf_log_frontend.c(45): warning: #231-D: declaration is not visible outside of function } log_data_t; ..............\components\libraries\log\src\nrf_log_frontend.c(47): error: #85: invalid storage class for a parameter static log_data_t m_log_data; ..............\components\libraries\log\src\nrf_log_frontend.c(47): error: #99: a declaration here must declare a parameter static log_data_t m_log_data; ..............\components\libraries\log\src\nrf_log_frontend.c(116): warning: #99-D: a declaration here must declare a parameter typedef struct ..............\components\libraries\log\src\nrf_log_frontend.c(121): warning: #231-D: declaration is not visible outside of function } nrf_log_generic_header_t; ..............\components\libraries\log\src\nrf_log_frontend.c(123): warning: #99-D: a declaration here must declare a parameter typedef struct ..............\components\libraries\log\src\nrf_log_frontend.c(130): warning: #231-D: declaration is not visible outside of function } nrf_log_std_header_t; ..............\components\libraries\log\src\nrf_log_frontend.c(132): warning: #99-D: a declaration here must declare a parameter typedef struct ..............\components\libraries\log\src\nrf_log_frontend.c(140): warning: #231-D: declaration is not visible outside of function } nrf_log_hexdump_header_t; ..............\components\libraries\log\src\nrf_log_frontend.c(142): warning: #99-D: a declaration here must declare a parameter typedef struct ..............\components\libraries\log\src\nrf_log_frontend.c(149): warning: #231-D: declaration is not visible outside of function } nrf_log_pushed_header_t; ..............\components\libraries\log\src\nrf_log_frontend.c(151): warning: #99-D: a declaration here must declare a parameter typedef union ..............\components\libraries\log\src\nrf_log_frontend.c(158): warning: #231-D: declaration is not visible outside of function } nrf_log_header_t; ..............\components\libraries\log\src\nrf_log_frontend.c(233): error: #99: a declaration here must declare a parameter ret_code_t nrf_log_init(nrf_log_timestamp_func_t timestamp_func) ..............\components\libraries\log\src\nrf_log_frontend.c(233): error: #101: "nrf_log_init" has already been declared in the current scope ret_code_t nrf_log_init(nrf_log_timestamp_func_t timestamp_func) ..............\components\libraries\log\src\nrf_log_frontend.c(234): error: #65: expected a ";" { ..............\components\libraries\log\src\nrf_log_frontend.c(652): warning: #12-D: parsing restarts here after previous syntax error while (curr_offset < length); ..............\components\libraries\log\src\nrf_log_ctrl_internal.h(26): warning: #1079-D: standard requires that parameter "timestamp_func" be given a type by a subsequent declaration ("int" assumed) nrf_log_init(timestamp_func) ..............\components\libraries\log\src\nrf_log_frontend.c(678): error: #130: expected a "{" } ..............\components\libraries\log\src\nrf_log_frontend.c(683): error: #20: identifier "m_log_data" is undefined return (m_log_data.rd_idx == m_log_data.wr_idx); ..............\components\libraries\log\src\nrf_log_frontend.c(694): error: #20: identifier "m_log_data" is undefined uint32_t rd_idx = m_log_data.rd_idx; ..............\components\libraries\log\src\nrf_log_frontend.c(698): error: #20: identifier "nrf_log_header_t" is undefined nrf_log_header_t header; ..............\components\libraries\log\src\nrf_log_frontend.c(795): warning: #223-D: function "nrf_log_backend_getchar" declared implicitly return nrf_log_backend_getchar(); ..............\components\libraries\log\src\nrf_log_frontend.c: 22 warnings, 19 errors compiling RTT_Syscalls_KEIL.c... compiling SEGGER_RTT.c... compiling SEGGER_RTT_printf.c... assembling arm_startup_nrf51.s... compiling system_nrf51.c... "._build\nrf51422_xxac.axf" - 115 Error(s), 70 Warning(s). Target not created. Build Time Elapsed: 00:00:07

    please tell me why its happened.

    Pallavi

Related