Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

UART communication using NRF24le1 (Part 10/14)

By Amanpreet Singh November 14, 2021

UART with NRF24LE1

In this modern world we all are aware about USB. We all connect our Pen drives, memory card and other devices using USB. But have you ever thought what is it? Here is the answer; USB is a communication protocol by which two devices communicate with each other. In the same way, microcontroller also communicates with other devices like sensors or PC by using different communication protocols like USB, UART, and I2C.

Today our focus will be on using UART communication for NRF24LE1.

Overview of Serial Communication with NRF24LE1 Module

Fig. 1: Overview of Serial Communication with NRF24LE1 Module

UART stands for Universal Asynchronous Receiver/Transmitter. It is a type of serial communication that uses two wires, one for transmission (Tx) and one for reception (Rx). It makes use of start and stop bits in the packet to indicate the start and end of the packet. We also have an option to use parity bit inside data to indicate error in the transmitted data. Before using UART we have to declare the transmission and reception speed known as baud rate. The most common baud rate is 9600 bps (bits per second).

Image Showing Components Used in Serial Communication With NRF24LE1 Module

Fig. 2: Image showing components used in serial communication with NRF24LE1 Module

The NRF module offers variety of baud rate starting from 600 bps up to 38400 bps. The NRF pin P0.3 is Tx and pin P0.4 is Rx.

For more features you can refer to the datasheet. Also, you may refer to our previous articles on UART with PC and NRF24LE1 for more help.

We will be using nrfsdk (software development kit) provided by Nordic Semiconductors Ltd. The communication will be established between NRF and PC by sending “Hello” to the PC.

Functions which are helpful for using UART are:

·        hal_uart_init() – This function takes baud rate to be used.

·        hal_uart_tx_complete() – Checks for the completion of transmission.

·        Hal_uart_putchar() – This function takes character for transmission.

·        hal_uart_chars_available() – Checks if a character has been received or not.

·         hal_uart_getchar() – It returns received character.

The description of the various functions is:

FUNCTION INPUT PARAMETER OUTPUT

DESCRIPTION

hal_uart_init()

UART_BAUD_600

UART_BAUD_1K2

UART_BAUD_2K4

UART_BAUD_4K8

UART_BAUD_9K6

UART_BAUD_19K2

UART_BAUD_38K4

UART_BAUD_57K6

UART_BAUD_115K2

    –

To initialize the UART communication by selecting the baud rate

hal_uart_putchar() 8-bit character  – To transmit 8-bit character
hal_uart_tx_complete()  – 0/1

To check status of transmission

0: Transmitting

1:Transmitted

hal_uart_char_available()  – 8-bit number To get the number of characters received
hal_uart_getchar()  – 8-bit character To read the 8-bit character received

Please check the commented code for complete implementation of these functions so as to get a clear understanding.

Image Showing Received Message on Virtual Terminal on PC from NRF24LE1 Module

Fig. 3: Image showing received message on virtual terminal on PC from NRF24LE1 Module

 

You may also like:


  • What are the top development boards for AI and ML?

  • What are LoRa gateways and what types are available?

  • What battery chemistries are used in electric vehicles?
  • VHDL
    VHDL Tutorial 1: Introduction to VHDL

  • Motion detectors or motion sensors?

  • What is the 1-Wire protocol?

Project Source Code

###

//Program to 

#include"reg24le1.h" // I/O header file for NRF24LE1

#include"hal_uart.h" // library containing serial communication functions
#include"hal_delay.h" // header file containing delay functions
 
 
// Repeated putchar to print a string
void putstring(char *s)
{
  while(*s != 0)
     hal_uart_putchar(*s++);
}
 
 
// main function
void main()
{
P0DIR = 0xf0;  // set P03 as output and P04 as input;
 
// Initializes the UART
  hal_uart_init(UART_BAUD_9K6);
 
// Enable global interrupts
  EA = 1;
 
//infinite loop
while(1)
{
// Print "Hello Everyone"
putstring("rnHello Everyone!!rn") ;
delay_ms(1000); // delay of 1sec
}
 
}

###

 


Circuit Diagrams

Circuit-Diagram-NRF24LE1-Module-PC-interfacing-over-UART

Project Video


Filed Under: Tutorials

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Exporting sensor readings as data...
  • Inconsistent Charge Termination Voltage with battery charger
  • 21V keeps getting shorted to my UART line.
  • Voltage mode pushpull is a nonsense SMPS?
  • Voltage mode push pull with extra DC blocking capacitor

RSS Electro-Tech-Online.com Discussions

  • Is AI making embedded software developers more productive?
  • Why can't I breadboard this oscillator?
  • using a RTC in SF basic
  • Parts required for a personal project
  • Cataract Lens Options?

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • GigaDevice launches GD32C231 MCU series with 48MHz Cortex-M23 core and 64KB Flash
  • Advanced Energy releases 425 W CF-rated medical power supply in 3.5 x 6 x 1.5-inch format”
  • LEM combines shunt and Hall effect sensing in 2000 A current measurement unit
  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe