minht57 / TIVA_CC1101_UART

Source code for module CC1101 based on Tiva C123 (TM4C123GH6PM)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WIRELESS TRANSMISSION WITH RADIO FREQUENCY

Introduction

The objective of this project was to send and receive data between MCU and MCU, computer and computer or MCU and computer without wire. This project focused on setting modules and config MCU to communicate between MCU and CC1101 using buffer to store data.

Dependent

IDE: Code Composer Studio version 7.3.
Library: TivaWare C Series 2.1.4.178.
TivaC TM4C123GH6PM.
RF UART CC1101 433Mhz HC-11.
	Supply voltage: 3.3-5 VDC.
	Transmission frequency: 433Mhz.
	Transmission distance: 0-200m.
	Communication: UART/TTL.
	Broadcast power: 1-10 dBm.

Structure

How to build, run the demo and run the tests

A. Config two RFs

Connect CC1101 to USB-TTL (CP2102), make RF entering AT mode.

      |     C1101 |         | CP2102    | 
      |     SET   |   --    | GND       |  
      |     TX    |   --    | RX        | 
      |     RX    |   --    | TX        |

Check driver software in Device Manager (Window + X and press M), if missing, get driver at here.

Open Hercules and set up as the picture below. Note: Serial name can get in Device Manager.

Two RFs must have the same channel, address and non must be 0.

Use these command:

  1. AT : test the mode, reply OK if correct.
  2. AT+Axxx: change module address, from 000-255.
  3. AT+Bxxxx: change baud rate, can be set to: 2400, 4800, 9600, 115200, 19200, 38400, 57600. Default is 9600.
  4. AT+Cxxx: change channel, from 001 to 127. Default is 001 (suggest to use 1 ~ 100 for stable performance).
  5. AT+Px: set wireless power, x is from 1 to 8, base on distance. Default is 8
  6. AT+Rx: show all parameter settings. For more information, download datasheet.

B. Setting TivaC

Download source code. Import code to CCS. I suggest creating new project and moving necessary files because not matching location of Tivaware driverlib can make some issues.

Connect TivaC and RF carefully and connect TivaC to computer.

      |   TIVA C   |       |  MODULE CC1101 |
      |         3v3|-------|VCC             |
      |         GND|-------|GND             | 
      |         PB0|-------|TXD             |
      |         PB1|-------|RXD             |

If TivaC in send mode: uncomment this line.

		//#define TX

If TivaC in receive mode : comment this line.

		#define TX

Build, upload and run code.

Some available functions:

	UART_C1101_Write() : send data with length.

	UART_C1101_WriteCMD() : send data until ‘\0’ char.

	UART_C1101_Read() : read data with length.

Result

Test with echo program:

 uint8_t GetData[50];

 While(1)
   {
      UART_C1101_Read(GetData,6);
      SysCtlDelay(SysCtlClockGet()/30);
      UART_C1101_WriteCMD(GetData);
      SysCtlDelay(SysCtlClockGet()/30);
   }

Data is received and resent to terminal successfully.

If you failed, you could check some things below:

• Two RFs must have the same setting.

• Connections (Vcc, GND, Tx, Rx).

• Code has no bug and correct baudrate with RFs.

• Your luck :D


About

Source code for module CC1101 based on Tiva C123 (TM4C123GH6PM)


Languages

Language:C 57.9%Language:Makefile 38.3%Language:Batchfile 3.9%