spirilis / msprf24

nRF24L01+ Library for MSP430 microcontroller line
ISC License
102 stars 32 forks source link

RX mode issues #9

Closed janek83 closed 11 years ago

janek83 commented 11 years ago

Hi,

I',m having problem with RX mode. I am using a little modified example of receiver:

...

msprf24_activate_rx();
LPM4;

while (1) {
    if (rf_irq & RF24_IRQ_FLAGGED) {
        msprf24_get_irq_reason();
    }
    if (rf_irq & RF24_IRQ_RX || msprf24_rx_pending()) {
        r_rx_payload(32, buf);
        msprf24_irq_clear(RF24_IRQ_RX);
        P1OUT ^= BIT0; // toggle red LED
    }
    msprf24_activate_rx(); // works once without it
    LPM4;
}

But it stops receiving after first packet received (red LED stays lit forever after receiving), so after a while I've added msprf24_activate_rx() on end of loop, right before LPM4 call. Now it works but for random amount of time, ie: 1 to 20 of times, then hangs again. Transmitter sends the same date every 2 seconds.

Received data corresponds to what was send

I'm running on 8MHz with 8MHz SMCLK, dynamic payload, rf_addr_width(3), msprf24_set_retransmit_delay(1000) - in traansmitter code msprf24_set_retransmit_count(3) - in traansmitter code

Wires length (Launchpad <-> nrf24l01+) about 20cm.

What might be wrong? Why adding msprf24_activate_rx() is necessary on every wake up but not present in your examples? Your example of receiver also stops after first packet.

spirilis commented 11 years ago

You should never have to re-enter msprf24_activate_rx() if you never exit it. My examples don't include that because they work. I am quite puzzled here though. Is something happening to your CE line? Wonder if it's a genuine silicon bug or bad chip.

janek83 commented 11 years ago

I've found out what was wrong studying your example of TX node :)

It was my fault on transmitter side. I've enabled AUTO ACKs but set pipe 0 address to different address than TX address - that was the reason and source of all weirdness.

Now everythings work like it should, sorry to bother you spirilis, you've made a great lib :)

spirilis commented 11 years ago

Sweet, good luck!

Rogil commented 10 years ago

Hello Spirilis, I'm trying with ACK PAYLOAD, practicly without variations from Ike's programs, I activate it whit "msprf24_enable_feature(RF24_EN_ACK_PAY); // ACK Payload" and in the PRX I use "w_ack_payload", pipe 0, same address for PTX and PRX for payload and ack payload, th PRX seems to work, when I see the IRQ for Tx and Rx, are set, but the PTX, always is in IRQ_ERROR.

Please give me any idea, I don't know what I'm doing wrong.

Thanks, ANDRÉS FELIPE RODRÍGUEZ

spirilis commented 10 years ago

Hmm, tbh I never tested that feature. Won't be of much help here.

Rogil commented 10 years ago

Hello, I've been keeping on with this ack payload issue, and works without changing anything in your code , I started debbug on my launchpad, and I stopped it for no reason and suddenly works, I mean the bits 6 and 5 were set in PTX in the rf_irq register, but when I started over, the error bit 4 was set again, could this give some idea, anything you could tell me would be fine. Thanks

Rogil commented 10 years ago

Ok, Eric Ack_paylaod working sweet.