attiny2313a+se8r01

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi

 

i want  to use this library with se8r01 but it not working can some one help me modifying it to work with this module

 

i use platformio 

 

#include <avr/io.h>

#include <util/delay.h>

#include <inttypes.h>

//#include <avr/interrupt.h>

#include "psx.h"

#include "nrf24.h"

//#include "uart.h"

#include <avr/pgmspace.h>

 

//#define F_CPU 8000000L

 

#define NRF24_IO_PORT PORTB

#define NRF24_IO_PINREG PINB

#define NRF24_IO_DDR DDRB

#define LED DDRD

 

//     ATTINY2313A      nrf24

//     ________      _________

//    |    PB3 |----| CSN     |

//    |    PB4 |----| CE      |

//    |    PB5 |----| MOSI    |

//    |    PB6 |----| MISO    |

//    |    PB7 |----| SCK     |

//    |        |    |_________|

//    |        |

//    |        |      PSX

//    |        |     _________

//    |    PD2 |----| SCK     |

//    |    PD3 |----| CS      |

//    |    PD4 |----| DO      |

//    |    PD5 |----| DI      |

//    |________|    |_________|

 

uint8_t data_array[2];

uint8_t tx_address[5] = {0xE7, 0xE7, 0xE7, 0xE7, 0xE7};

uint8_t rx_address[5] = {0xD7, 0xD7, 0xD7, 0xD7, 0xD7};

 

int main() {

 

initUART();

 

PORTD |=(1<<6);

    nrf24_init();

 

    nrf24_config(2, 2); // channel 2, packet size 2

 

    nrf24_tx_address(tx_address);

    nrf24_rx_address(rx_address);

 

    psx_init(false);

 

    while (1) {

 

        psx_read_gamepad(); // gamepad reading  

       

        data_array[0] = 0xFE; // test value

 

         // up - left chassis forward

         // down - left chassis back

         // triangle - right landing gear forward

         // cross - right landing gear back

        data_array[1] = (psx_button(PSB_PAD_UP) << 1) | (psx_button(PSB_PAD_DOWN) << 2)

                        | (psx_button(PSB_TRIANGLE) << 3) | (psx_button(PSB_CROSS) << 4)

                        | (psx_stick(PSS_LX)<< 5 ) | (psx_stick(PSS_LY) << 6)

                        | (psx_stick(PSS_RX)<< 7 ) | (psx_stick(PSS_RY) << 8); // push buttons

 

        nrf24_send(data_array); // send data

        while (!nrf24_isSending());

        _delay_ms(20);

   

      //UDR=(psx_button(PSB_PAD_DOWN));

       sendByte(data_array[1]);    

 

    }

}

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Welcome to AVRFreaks!

voltex wrote:
i want  to use this library with se8r01 but it not working can some one help me modifying it to work with this module

Well to get help on a public forum, you need to provide links to the device, and help us understand what you mean by "not working", what is not working?

A quick google search shows the se8r01 is a 2.4GHz wireless module with an SPI interface. 

Any RF link will be unreliable, so you must expect it to "not work" and handle that condition when it happens, ie. retry your packet transmission, add FEC, or provide for the possibility the link can and will fail at times.

Of course the problem may be hardware related, ie. not enough power supply for the transmit power load, or miss wiring or flacky bread board connections, tell us what you have done so far to trouble shoot your problem, what ever it may be....

 

 

Jim

PS, have you tried this Arduino example code using an Uno?

https://github.com/oldgin/NRF24L...

 

FF = PI > S.E.T

 

Last Edited: Fri. May 13, 2022 - 12:53 PM