CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

MRF24J40 problems with Acknowledgment...

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rvalor



Joined: 16 Apr 2009
Posts: 18
Location: Spain

View user's profile Send private message

MRF24J40 problems with Acknowledgment...
PostPosted: Wed Jul 07, 2010 9:54 am     Reply with quote

Hello people in this forum¡

I'm working with the MRF24J40MA module, I communicate two devices, both PAN coordinator. One is the transmitter and the other the receiver. The communication works fine, but now I'm trying to enhance it.

The first communication enhancement is to add ACK, so when I format a packet, when adding the "Frame Control Field" I put to 1 the ACK REQUEST bit, next I modify the ACK bit in the TXNCON register. I do this for every transmitted packet.

In the receiver side, I configure the ACKRSP bit in the RXMCR register in order to let the module send an ACK if it is specified in the receiving packet.

With this configuration, I send packets when the receiver is off and don't have any tx error, I always get a tx successful transmission.

Anybody know about this??

Thanks you very much in advance¡¡
laurent-o



Joined: 14 Jul 2010
Posts: 2

View user's profile Send private message

PostPosted: Wed Jul 14, 2010 3:46 am     Reply with quote

Hello,

I have the same problem, no solution yet.
rvalor



Joined: 16 Apr 2009
Posts: 18
Location: Spain

View user's profile Send private message

Sorry, I found the solution...
PostPosted: Wed Jul 14, 2010 7:59 am     Reply with quote

I found a solution, after pulling up and down the WAKE pin, a RF reset is needed:
Code:

OUTPUT_HIGH(WAKE);
delay_ms(3); //delay of at least 2ms
OUTPUT_LOW(WAKE);

//Reset RF State machine in order to get more  packets ¿¿??
__SPI_ShortWrite(WRITE_RFCTL,0x04);
 __SPI_ShortWrite(WRITE_RFCTL,0x00);
   
/wait until RX state...
do
{
      i = __SPI_LongRead(RFSTATE);
}
while((i & RX) != RX);

Although nothing is said in datasheet, this solves the problem and the module works fine but I don't know why.

Bye¡
laurent-o



Joined: 14 Jul 2010
Posts: 2

View user's profile Send private message

PostPosted: Mon Jul 19, 2010 2:09 am     Reply with quote

Can you send me an example of your header please. My receiver only accept the frame in promiscuous mode and don't send any acknowledgment frame.

Thank you for your help.
rvalor



Joined: 16 Apr 2009
Posts: 18
Location: Spain

View user's profile Send private message

PostPosted: Mon Jul 19, 2010 3:45 am     Reply with quote

Quote:

My receiver only accept the frame in promiscuous mode


In both normal and promiscuous modes, packets are stored in the rxnormal buffer unless they have a bad CRC (page 106 in MRF24J40 datasheet). So I think your problem relates with frame format, check your packet complies IEEE 802.15.4 specification.

I used the MAC DATA frame, the format is the following (a broad outline...):

- MHR header containing:
> Frame control.
> Sequence number.
> Addressing fields.
- MAC Payload -> your application data... and
- FCS field

The "Frame control Field" is the most important field. You must format it (2 bytes) according to your requirements (Frame type, ack, security, frame pending, addressing).
The "Sequence number" is used to relate the ack packet and the frame that was "ack'ed". I always use this field with 0 value.
The "Addressing fields" describes the addressing schema your are using (short or long MAC, PAN identifiers included, etc).

The possible values of each field is described in the IEEE standard.

Once you have a well formed packet you must store it in the tx buffer in this way:

Tx[0] <- Length of the MHR header (will be ignored unless security is used)
Tx[1] <- Length of the MHR + PAYLOAD
Tx[2 and above] <- The entire packet (MHR + PAYLOAD)

FCS field is added by MRF24J40...

I found a good pdf concerning IEEE 802.15.4 standard and the frame format is pretty explained, I can send it to you if you let me know your email.


Quote:

don't send any acknowledgment frame



In order to use the ACK, your MAC DATA FRAME must have the ack bit and the receiver must be configured as follows:

Quote:

//----------------------------------------
// configuracion de recepcion
//----------------------------------------
cRegval |= RXMCR_ACKRSP; //ACK if requested...
cRegval |= RXMCR_PANCOORD; //Coordinador PAN
__SPI_ShortWrite(WRITE_RXMCR, cRegval);



I hope it would helping... and sorry for my english.
quijano930a



Joined: 13 Dec 2014
Posts: 5

View user's profile Send private message

PostPosted: Tue Jan 31, 2017 10:39 pm     Reply with quote

hi i have the same problem anyone resolve the problem here is my structure of tx fifo
Code:
void write_TX_normal_FIFO(void){
   int i = 0;

   data_TX_normal_FIFO[0]  = HEADER_LENGHT;
   data_TX_normal_FIFO[1]  = HEADER_LENGHT + DATA_LENGHT;
   data_TX_normal_FIFO[2]  = 0x05;                        // control frame
   data_TX_normal_FIFO[3]  = 0x88;
   data_TX_normal_FIFO[4]  = SEQ_NUMBER;                  // sequence number
   data_TX_normal_FIFO[5]  = PAN_ID_2[1];                 // destinatoin pan
   data_TX_normal_FIFO[6]  = PAN_ID_2[0];
   data_TX_normal_FIFO[7]  = ADDRESS_short_2[0];          // destination address 
   data_TX_normal_FIFO[8]  = ADDRESS_short_2[1]; 
   data_TX_normal_FIFO[9]  = PAN_ID_1[0];                 // source pan
   data_TX_normal_FIFO[10] = PAN_ID_1[1];
   data_TX_normal_FIFO[11] = ADDRESS_short_1[0];          // source address
   data_TX_normal_FIFO[12] = ADDRESS_short_1[1];

   data_TX_normal_FIFO[13] = DATA_TX[0];                  // data
   data_TX_normal_FIFO[14] = DATA_TX[1];
   data_TX_normal_FIFO[15] = DATA_TX[2];

   for(i = 0; i < (HEADER_LENGHT + DATA_LENGHT + 2); i++)
   {
    write_ZIGBEE_long(address_TX_normal_FIFO + i, data_TX_normal_FIFO[i]); // write frame into normal FIFO
   }

   set_ACK();
   set_not_encrypt();
   start_transmit();
   
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group