Skip to content

ali-ghazi78/my_spi_lib_xmega

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

XMEGA NRF24L01+ Communication Project

This project demonstrates how to interface an Atmel XMEGA microcontroller with the nRF24L01+ 2.4 GHz RF transceiver using SPI communication.
It also includes utility code for USART, I²C (TWI), PWM, GPIO control, and SPI drivers.


📂 Project Structure

  • nrf24l01_.h

    • Low-level driver for the nRF24L01+ transceiver
    • Provides functions to:
      • Initialize as receiver or transmitter
      • Read/write registers
      • Load TX buffer and read RX buffer
      • Control CE/CSN pins for SPI transactions
  • myFirstXmega.c

    • Main application code running on the XMEGA
    • Initializes 32 MHz clock, USART, SPI, GPIO
    • Provides helper functions for:
      • LED and button testing
      • USART TX/RX with interrupts
      • I²C routines for external sensors (e.g., MPU6050)
      • PWM generation (example at 38 kHz)
    • Demonstrates RF data transmit/receive via nRF24L01+
  • MY_SPI.cpp

    • Hardware abstraction layer for SPI communication
    • Functions include:
      • spi_init(...) → Configure SPI
      • spi_write(...) → Write a byte
      • spi(...) → Full-duplex transfer
      • spi_read(...) → Read received byte

✨ Features

  • SPI communication with nRF24L01+
  • Dual role: transmitter and receiver
  • Interrupt-based UART communication
  • Software I²C routines
  • PWM generation example
  • LED/button testing utilities

🔧 Hardware

  • Microcontroller: Atmel XMEGA (tested on ATxmega128A1)
  • RF Module: nRF24L01+ (2.4 GHz)
  • Connections:
    • SPI: MOSI, MISO, SCK, CSN, CE
    • GPIO: LEDs, buttons
    • USART: Serial debugging
    • I²C: External sensors

git clone https://github.com/yourusername/xmega-nrf24l01.git

About

spi and nrf24l01+

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages