2023-09-29 06:47 PM
Hello,
I am currently using a custom-built board designed to the nRF24L01+ specification and using the same exact circuit provided in their datasheet. It is connected to my STM32F103 through SPI. I am currently using this library to test out this board: https://github.com/elmot/nrf24l01-lib/tree/master
The board is able to successfully verify that it is connected to the NRF chip using the nRF24_Check() function. Furthermore, the nRF is returning back that a packet (without AA) has been sent successfully and subsequently clears the TX FIFO. On my receiver device, the RX FIFO does not get populated nor any interrupts triggered by the nRF which leads me to the assumption that there is a problem somewhere with the wireless transmission of the packet. If I were to enable AA, and also put my receiver device on the ESB RX example, then the nRF would return that the maximum number of transmissions has occurred.
It is my first time attempting to debug a wireless device that I have made so I would appreciate any help or suggestions on where to look and what to verify.
2023-10-02 05:11 PM
I've included the modified Nordic NRF24L01 library that I've added all the low-level functions for STM32 HAL.
/* Include radio and radio_<mode> */
#include "radio.h"
#include "radio_esb.h"
// Global space
// Radio
static const uint8_t address[HAL_NRF_AW_5BYTES] = {
0x33,
0x44,
0x55,
0x66,
0x01
};
extern uint8_t pload[RF_PAYLOAD_LENGTH]; // Declared in the NRF24L01 Library
// In your main
radio_esb_init(address, HAL_NRF_PRX); // Address of the device and Primary RX or TX
// Super loop
radio_irq();
radio_status = radio_get_status();
uint8_t rx_data[20];
// Data received
if(radio_status == RF_RX_DR)
{
memcpy((void*)rx_data, (void*)pload, sizeof(PACKET_SIZE));
}
// Interrupt is enabled by default
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if(GPIO_Pin == NRF_IRQ_Pin)
{
HAL_GPIO_TogglePin(LED_GREEN_GPIO_Port, LED_GREEN_Pin);
}
}
2023-10-03 08:53 AM
Tried your code out, still no communication between devices. The device, when transmitting a packet, sets itself into the RF_BUSY state, and shortly thereafter into the RF_MAX_RT state. Meanwhile, the other device never enters the RF_RX_DR state. Here is the code that I am using to test this out.
#ifdef RX
radio_esb_init(address, HAL_NRF_PRX); // Address of the device and Primary RX or TX
#endif
#ifdef TX
radio_esb_init(address, HAL_NRF_PTX); // Address of the device and Primary RX or TX
uint8_t tx_data[20] = {0xAA, 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA};
#endif
writeRGB(BLUE);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
radio_irq();
radio_status_t radio_status = radio_get_status();
uint8_t rx_data[20];
if (radio_status == RF_IDLE){
writeRGB(BLUE);
#ifdef TX
HAL_Delay(200);
radio_send_packet(&tx_data, 20);
#endif
}
if (radio_status == RF_BUSY){
writeRGB(GREEN);
}
if (radio_status == RF_MAX_RT){
writeRGB(RED);
#ifdef TX
HAL_Delay(200);
radio_send_packet(&tx_data, 20);
#endif
}
if(radio_status == RF_RX_DR)
{
HAL_GPIO_TogglePin(STATUS_1_GPIO_Port, STATUS_1_Pin);
memcpy((void*)rx_data, (void*)pload, 20);
writeRGB(WHITE);
}
}
2023-10-03 10:27 AM
Could you post your address for each of the devices?
2023-10-03 10:52 AM
Sure, its the same one that you provided in your example.
Both devices use this address:
static const uint8_t address[HAL_NRF_AW_5BYTES] = {
0x33,
0x44,
0x55,
0x66,
0x01
};
2023-10-04 04:27 PM - edited 2023-10-04 04:28 PM
Jeremyc123 it seems that everything is in order and should work as designed. Aside from looking at hardware, the only thing that comes to mind is making sure that the CSN and CE lines are set at power on.
HAL_GPIO_WritePin(NRF_CE_GPIO_Port, NRF_CE_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(NRF_CSN_GPIO_Port, NRF_CSN_Pin, GPIO_PIN_SET);
That's a long shot, but the only software solution I can think of.
2024-01-12 07:00 AM
It sounds like the reciever is not being set up correctly, thus never sending the acknowledgement back to the sender. Make sure the TX and RX addresses are the same on both devices.
Perhaps compare the implementations. This works perfectly for full duplex communication with ACK in the STM8
https://github.com/nicogutz/NRF24_STM8_Library
Be careful because the endianness of the STM8 and the STM32 is different.