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

Problem with the nRF24L01+ when trying to swap between Transmitter and Receiver

Hi all,

The setup that I am aiming for has a number of nodes, which will send the IMU data to a central base station. The communication is achieved using a bunch of nRF24L01+ modules.
So far I have been able to transmit and receive the data from one node to the base station. The problem starts when I want to swap the roles of the node and the base station so that I can transmit and receive the data bi-directionally.
Initially, the base station (configured as TX) sends an 8-byte data to the node (configured as RX). After checking the received data, the node (configured as TX) sends back the IMU data to the base station (configured as RX).

Somehow, after the node receives the data from the base station, it is never able to send the IMU data back to the base station. The TX is done with polling and the RX is done with interrupts.
Can anyone of you point me in the right direction? Thanks!

Additional info:
The nRF (module from Sparkfun) is interfaced with Atmega32U4. IDE is Atmel Studio v7 in Windows platform.

Base station code:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
* Base_Station.c
*
* Created: 21-Nov-18 6:18:12 PM
* Author : Frederic Philips
*/
#include <avr/io.h>
#include <avr/sfr_defs.h>
#include <stdint.h>
#include <stdlib.h>
#define F_CPU 16000000UL //16 MHz frequency
#define BAUD 57600
#include <util/setbaud.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "nrf.h"
#define MOSI 2
#define MISO 3
#define SCLK 1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Node code:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
* Node_1.c
*
* Created: 21-Nov-18 6:21:39 PM
* Author : Frederic Philips
*/
#include <avr/io.h>
#include <avr/sfr_defs.h>
#include <stdint.h>
#include <stdlib.h>
#define F_CPU 16000000UL //16 MHz frequency
#define BAUD 57600
#include <util/setbaud.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "Test_BNO055.h"
#include "i2cmaster.h"
#include "nrf.h"
#define MOSI 2
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX