<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>IRQ not triggered even though the emission status seems ok.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/37054/irq-not-triggered-even-though-the-emission-status-seems-ok</link><description>Hi, 
 I&amp;#39;ve been using the nRF24l01+ for some time now and am quite satisfied. I&amp;#39;m having a new issue that I&amp;#39;m unable to explain and for which I would greatly appreciate some help. 
 I have two units comunicating together using the following scheme: 
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 13 Aug 2018 08:01:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/37054/irq-not-triggered-even-though-the-emission-status-seems-ok" /><item><title>RE: IRQ not triggered even though the emission status seems ok.</title><link>https://devzone.nordicsemi.com/thread/143858?ContentTypeID=1</link><pubDate>Mon, 13 Aug 2018 08:01:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ac29c5e-0198-4513-bbf6-8421e1405282</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am not familiar with Arduino, but the flow should be:&lt;/p&gt;
&lt;p&gt;Set in receive mode.&lt;br /&gt;Wait for packet received (RX_DR).&lt;br /&gt;If packet received (RX_DR), wait 500us to ensure ACK is sent (Are you doing this step?).&lt;br /&gt;Stop receive mode, set in transmit mode.&lt;br /&gt;Send packet.&lt;br /&gt;Wait for packet sent (TX_DS or MAX_RT).&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IRQ not triggered even though the emission status seems ok.</title><link>https://devzone.nordicsemi.com/thread/143628?ContentTypeID=1</link><pubDate>Thu, 09 Aug 2018 16:53:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:011c7aef-3044-4441-a0a0-571e702c1679</guid><dc:creator>Thomass</dc:creator><description>&lt;p&gt;Thank you for your help...&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve cleaned my code so you can have a look at it. I work on an arduino DUE with nRF24L01+ modules.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There is one master device that initiates the communication and then the system follows the followin pattern :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Master sends message&amp;nbsp;1&lt;br /&gt;Salve answers with message&amp;nbsp;2&lt;br /&gt;Master answers with message 3&amp;nbsp;&lt;br /&gt;Master sends second answer with message 4&lt;br /&gt;And the loop starts again.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here is my code :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;SPI.h&amp;gt;
#include &amp;quot;nRF24L01.h&amp;quot;
#include &amp;quot;RF24.h&amp;quot;
#include &amp;quot;printf.h&amp;quot;

// Hardware configuration
RF24 globalRadio(57,77);                          // Set up nRF24L01 radio on SPI bus plus pins 7 &amp;amp; 8

class RF24Controller
{
	public:
	virtual ~RF24Controller();

	void			begin(int device);
	void	        Send(byte id);
	RF24			&amp;amp;_radio;


	//protected:
	RF24Controller(uint8_t IRQPin, uint8_t CEPin, uint8_t CSPin, RF24 &amp;amp; radio = globalRadio);
	uint32_t	_timeSync;
	
	byte	doInterrupt();
	bool	_isDoneTransmitting;
	uint8_t	_IRQPin;
};

// Demonstrates another method of setting up the addresses
byte address[][5] = { 0xCC,0xCE,0xCC,0xCE,0xCC , 0xCE,0xCC,0xCE,0xCC,0xCE};

volatile uint32_t emissionTimeStamp = 0;
volatile uint32_t receptionTimeStamp = 0;
volatile bool failed = false;

RF24Controller testRadio(55,57,77);

int role = 2; //1 master - 2 slave
/********************** Setup *********************/

void setup(){

	pinMode(55, INPUT);
	delay(20);
	
	SerialUSB.begin(115200);
	testRadio.begin(role);
}



/********************** Main Loop *********************/
void loop() {
	static uint32_t timer = 0;
	static bool resendInfo = false;
	static uint32_t lastSent = 0;
	
	if (role == 1)  {
		if(millis() - timer &amp;gt; 100)
		{
			SerialUSB.print(F(&amp;quot;Now sending &amp;quot;));
			SerialUSB.println(timer);
			testRadio.Send(1);
			timer = millis();
		}
	}
	
	byte id = testRadio.doInterrupt();

	if(id != 0)
	{
		SerialUSB.println(&amp;quot;Received &amp;quot; + String(id));
		if(id == 1)
		testRadio.Send(2);
		if(id == 2)
		{
			testRadio.Send(3);
			resendInfo = true;
			lastSent = millis();
		}
	}
	
	if(millis() - lastSent &amp;gt; 10 &amp;amp;&amp;amp; resendInfo)
	{
		testRadio.Send(4);
		resendInfo = false;
	}
}


RF24Controller::RF24Controller(uint8_t IRQPin, uint8_t CEPin,
uint8_t CSPin, RF24 &amp;amp; radio) : _radio(radio)
{
	_IRQPin = IRQPin;
	_timeSync = 0;
}

RF24Controller::~RF24Controller() {}

void		catchInterrupt()
{
	uint32_t interruptTime = micros();
	bool tx,fail,rx;
	
	globalRadio.whatHappened(tx,fail,rx);
	if ( tx || fail)
	{
		emissionTimeStamp = interruptTime;
		failed = fail;
	}
	else if ( rx || globalRadio.available())
	{
		receptionTimeStamp = interruptTime;
	}
}

byte     RF24Controller::doInterrupt()
{
	static uint32_t lastReceptionTime = 0;
	static uint32_t lastEmissionTime = 0;
	byte		tmp[32];
	uint8_t		size;
	
	if (lastReceptionTime != receptionTimeStamp)
	{
		lastReceptionTime = receptionTimeStamp;

		while (_radio.available())
		{
			size = _radio.getDynamicPayloadSize();
			_radio.read(tmp, size);
		}
		return (tmp[0]);
	}
	else if (emissionTimeStamp != lastEmissionTime)
	{
		lastEmissionTime = emissionTimeStamp;
		_radio.flush_tx();
		_radio.startListening();
		SerialUSB.println(&amp;quot;Emission\t&amp;quot; + String(failed));
	}
	
	return 0;
}

void		RF24Controller::begin(int device)
{
	pinMode(_IRQPin, INPUT);
	byte address2[][5] = { 0xCC,0xCE,0xCC,0xCE,0xCC , 0xCE,0xCC,0xCE,0xCC,0xCE};
	_radio.begin();
	_radio.setPALevel(RF24_PA_MAX);
	//globalRadio.setDataRate(RF24_250KBPS);
	_radio.setRetries(0, 0);
	_radio.enableDynamicPayloads();
	//_radio.setChannel(108);
	_radio.setAutoAck(true);

	if(device == 1)
	{
		_radio.openReadingPipe(1, address2[1]);
		_radio.openWritingPipe(address2[0]);
	}
	else if(device == 2)
	{
		_radio.openReadingPipe(1, address2[0]);
		_radio.openWritingPipe(address2[1]);
	}
	_radio.startListening();
	
	delay(50);
	attachInterrupt(digitalPinToInterrupt(_IRQPin),
	catchInterrupt, LOW);
}

void			RF24Controller::Send(byte id)
{
	_radio.stopListening();
	
	byte buffer[30]= {0};
	buffer[0] = id;
	_radio.startWrite(buffer, 30, false);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I have defined a class that is supposed to deal with the RF24 messages.&amp;nbsp;&lt;br /&gt;Before the Setup you can define a role : 1 is master and 2 is slave.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I print each time i receive a message and also I print the fail status each time I send a message.&lt;br /&gt;Now when I have both devices communicating I should get the following information :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;On the master side :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Now sending 54641
Emission	0
Received 2
Emission	0
Emission	0&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And on the slave side:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Received 1
Emission	0
Received 3
Received 4&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But almost every two messages, I have the &amp;quot;Emission 0&amp;quot; on the slave side (which means that the message went over and the ACK was received) but I don&amp;#39;t have any &amp;quot;Received 2&amp;quot; on the master side.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And more incredibly, when I comment the &amp;quot;Send(4)&amp;quot; line everything works normally...&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I would really appreciate your help on this matter :D&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IRQ not triggered even though the emission status seems ok.</title><link>https://devzone.nordicsemi.com/thread/143578?ContentTypeID=1</link><pubDate>Thu, 09 Aug 2018 13:12:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:348a7489-e065-4624-b7f4-cbe40f0f3ca3</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Not entirely sure what is the problem no. For debugging I suggest to add some delays here between the steps (e.g. &amp;gt;1ms). Reason for this is to ensure that you don&amp;#39;t send a packet from the peer device, while the other device may still be waiting for an ACK, that can create odd results. Alternatively you can add a delay after RX_DR before you switch to TX mode to ensure ACK is sent.&lt;/p&gt;
&lt;p&gt;I also suggest that you add a counter in your packets, this to ensure that no packets are duplicates.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IRQ not triggered even though the emission status seems ok.</title><link>https://devzone.nordicsemi.com/thread/143371?ContentTypeID=1</link><pubDate>Wed, 08 Aug 2018 12:45:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e597eae2-5c7c-44ee-91c4-19f6eef9b49d</guid><dc:creator>Thomass</dc:creator><description>&lt;p&gt;Sorry for the delay, I was quite busy with another project.&amp;nbsp;&lt;br /&gt;I can confirm that it is indeed a TX_DS interrupt that I get.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m continuing the investigation on my side as well and so far I&amp;#39;ve been able to extract only the &amp;quot;RF24&amp;quot; part of my code and send dummy messages. Like that it seems to work normally so it might be related to something else in my code. But still it doesn&amp;#39;t seem to depend on the payload I send because changing the payload doesn&amp;#39;t change the behaviour...&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is there anything in the nRF24 that might explain a correclty sent ACK but not a interruption ?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I&amp;#39;ll keep you updated if I find something new.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IRQ not triggered even though the emission status seems ok.</title><link>https://devzone.nordicsemi.com/thread/143200?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 11:30:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1ef7d08-4a66-4987-9d2b-f8db0047e32d</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Could you also make sure you are checking the status register and that you are actually getting a TX_DS interrupt and not the MAX_RT interrupt?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IRQ not triggered even though the emission status seems ok.</title><link>https://devzone.nordicsemi.com/thread/143069?ContentTypeID=1</link><pubDate>Mon, 06 Aug 2018 15:08:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1af2968-18ac-4f9a-82ad-66b3ddad15f5</guid><dc:creator>Thomass</dc:creator><description>&lt;p&gt;I&amp;#39;m working on cleaning my code so that I can post a version of it.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IRQ not triggered even though the emission status seems ok.</title><link>https://devzone.nordicsemi.com/thread/143068?ContentTypeID=1</link><pubDate>Mon, 06 Aug 2018 15:07:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:478e4b76-638b-4e24-a413-8414bebe25d8</guid><dc:creator>Thomass</dc:creator><description>&lt;p&gt;Sorry, I meant that I disabled the ARC by setting it to zero.&amp;nbsp;&lt;br /&gt;The ARD was by default to 250&amp;micro;s and I just tried to increase it to a higher value with no succes.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IRQ not triggered even though the emission status seems ok.</title><link>https://devzone.nordicsemi.com/thread/143058?ContentTypeID=1</link><pubDate>Mon, 06 Aug 2018 14:19:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:843cf10f-e489-4746-8a7e-585f26fa940b</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;How have you disabled ARD? do you mean you set ARD to zero, or that you configured ARC to 0. As far as I can see from the specification ARD needs to be long enough for your device to receive the ack packet from the peer. minimum 500 µs for 250kbits. Set ARC to 0 to disable re-transmits.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IRQ not triggered even though the emission status seems ok.</title><link>https://devzone.nordicsemi.com/thread/142761?ContentTypeID=1</link><pubDate>Fri, 03 Aug 2018 09:26:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e027f0cf-503d-445c-a973-26aeafb8f549</guid><dc:creator>Thomass</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Thank you for your answer.&amp;nbsp;&lt;br /&gt;I&amp;#39;m using a &lt;a href="http://tmrh20.github.io/RF24/classRF24.html#aec71746d59da978bcbb975167886a2cc"&gt;specefic library to communicate with my device&lt;/a&gt;. This library states that the Auto ACK is enabled by default so I suppose I&amp;#39;m using the Auto ACK.&amp;nbsp;&lt;br /&gt;I have disables the ARD so I&amp;#39;m sending the message once.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The buadrate is 250 Kbps and the packet size is 32 bytes. I&amp;#39;m using the dynamic payload option.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To add some extra details, it really looks like the devices are communicating because the TX_DS is only asserted when Module 1 is powered. But it looks like Module 1 isn&amp;#39;t receiving the information from the device.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I hope it clarifies a bit my previous message.&lt;/p&gt;
&lt;p&gt;Thanks in advance for your help,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IRQ not triggered even though the emission status seems ok.</title><link>https://devzone.nordicsemi.com/thread/142740?ContentTypeID=1</link><pubDate>Fri, 03 Aug 2018 07:40:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:497f8856-6ef0-4659-8437-6560dac7d06b</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Are you using Auto acknowledgement (TX_DS is asserted when the packet is transmitted, if Auto_ack is activated this bit is set high only when ACK is received)? Auto Retransmisssion (ARD)? What is the ARD delay? and what is the baudrate and packet size?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>