Beginner
10 min

Achieve reliable RF communication for diverse applications with cc2500 and PIC24FJ256GA705

2.4GHz transceiver capable of various modulation schemes like OOK, 2-FSK, GFSK, and MSK

ccRF Click with PIC24FJ256GA7 Curiosity Development Board

Published Jan 31, 2024

Click board™

ccRF Click

Dev. board

PIC24FJ256GA7 Curiosity Development Board

Compiler

NECTO Studio

MCU

PIC24FJ256GA705

Develop a tiny radio station for things like remote control, home appliances, or other gadgets that need to send or receive information wirelessly

A

A

Hardware Overview

How does it work?

ccRF Click is based on the CC2500, a low-power, high-performance 2.4GHz transceiver from Texas Instruments, operating in the worldwide ISM frequency band from 2400MHz to 2483.5. The CC2500 has excellent receiver selectivity and blocking performance with an embedded packet handler engine suitable for packet-oriented systems. It also has a highly configurable baseband modem that supports various modulation formats (OOK, 2-FSK, GFSK, and MSK) and user-configurable parameters like frequency channel, output power, and air data rate. The transceiver has a programmable data rate from 1.2 to 500kBaud depending on frequency range over a PCB trace 2.4GHz antenna, making the ccRF Click

suitable for ultra-low power designs. The CC2500 has a built-in state machine that switches between different operation states (modes) to achieve optimum performance for many applications. Change of the states is performed using command strobes or internal events such as TX FIFO underflow. These states take care of Sleep, Idle, Active, Receive or Transmit modes, Wake-on-Radio (WOR), and more. In addition, the CC2500 comes with on-chip support for synchronization word detection, address check, flexible packet length, and automatic CRC handling. The ccRF Click uses an SPI serial interface to communicate with the host MCU. There are two pins in addition, the GD0 and GD2, routed where the RST and PWM pins of

the mikroBUS™ socket stand by default. With the GD2 as a digital output pin, the user can get test signals, FIFO status, clear channel indicator, serial output RX data, and more. The GD0 as a digital output pin can be used to get the same data as the GD2, plus it can provide serial input TX data. This Click board™ can only be operated with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. However, the Click board™ comes equipped with a library containing functions and an example code that can be used as a reference for further development.

ccRF Click hardware overview image

Features overview

Development board

PIC24FJ256GA7 Curiosity Development Board is a cost-effective, fully integrated 16-bit development platform for first-time users, makers, and those seeking a feature-rich rapid prototyping board. Designed from the ground up to take full advantage of Microchip’s MPLAB® X IDE, the board includes an integrated programmer/debugger. It requires no additional hardware, making it a perfect starting point to explore the latest low-cost and eXtreme Low Power (XLP) 16-bit PIC24FJ256GA705 family of microcontrollers. The PIC24FJ256GA7 Curiosity Board enables easy and faster adoption of low-cost

XLP 16-bit PIC24FJ256GA705 family of microcontrollers. PIC24FJ256GA705 microcontroller featuring up to 256KB of ECC flash and 16KB of RAM is ideally suited for low power general purpose applications. The layout and external connections of the PIC24FJ256GA7 Curiosity board offer unparalleled access to the Core Independent Peripherals (CIPs) such as CLC, MCCP, and DMA. These CIPs enable the user to integrate various system functions onto a single MCU, simplifying the design and keeping system power consumption, and BOM cost low. This board

can also enable applications with low power, low pin count, and small footprint requirements, as in IoT sensor nodes. Out of the box, the board offers several options for user interface—including switches, RGB LED, user LEDs, and analog potentiometers. In addition, wireless connectivity can easily be added using two mikroBUS™ interfaces and wireless connectivity Click boards™. A full complement of accessory boards is available via the MIKROE mikroBUS™ interfaces.

PIC24FJ256GA7 Curiosity double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

dsPIC

MCU Memory (KB)

256

Silicon Vendor

Microchip

Pin count

48

RAM (Bytes)

16384

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
General Purpose I/O
RA13
RST
SPI Chip Select
RC9
CS
SPI Clock
RB15
SCK
SPI Data OUT
RB13
MISO
SPI Data IN
RB14
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
General Purpose I/O
RC3
PWM
NC
NC
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

ccRF Click Schematic schematic

Step by step

Project assembly

PIC24FJ256GA7 Curiosity front image hardware assembly

Start by selecting your development board and Click board™. Begin with the PIC24FJ256GA7 Curiosity Development Board as your development board.

PIC24FJ256GA7 Curiosity front image hardware assembly
GNSS2 Click front image hardware assembly
Prog-cut hardware assembly
Board mapper by product7 hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
PIC24FJ256GA7 Curiosity MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support

Library Description

This library contains API for ccRF Click driver.

Key functions:

  • ccrf_writeBytes - Sequential ( burst ) write function.

  • ccrf_readBytes - Sequential ( burst ) read function.

  • ccrf_defaultConfiguration - Default configuration function.

Open Source

Code example

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.

/*!
 * \file 
 * \brief ccRF Click example
 * 
 * # Description
 * This example demonstrates the use of an ccRF Click board by showing
 * the communication between the two Click boards configured as a receiver and transmitter.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and logger, performs the Click default configuration and 
 * displays the selected application mode.
 *
 * ## Application Task
 * Depending on the selected mode, it reads all the received data or sends the desired message
 * every 2 seconds.
 * 
 * \author MikroE Team
 *
 */

#include "board.h"
#include "log.h"
#include "ccrf.h"

// Comment out the line below in order to switch the application mode to receiver
#define DEMO_APP_TRANSMITTER

// Text message to send in the transmitter application mode
#define DEMO_TEXT_MESSAGE           "MIKROE - ccRF Click board\0"

static ccrf_t ccrf;
static log_t logger;

void application_init ( void )
{
    log_cfg_t log_cfg;
    ccrf_cfg_t cfg;

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    ccrf_cfg_setup( &cfg );
    CCRF_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    ccrf_init( &ccrf, &cfg );

    ccrf_default_cfg( &ccrf );
    
#ifdef DEMO_APP_TRANSMITTER
    log_printf( &logger, " Application Mode: Transmitter\r\n" );
#else
    log_printf( &logger, " Application Mode: Receiver\r\n" );
#endif
    log_info( &logger, " Application Task " );
}

void application_task ( void )
{
#ifdef DEMO_APP_TRANSMITTER
    ccrf_transmit_packet( &ccrf, DEMO_TEXT_MESSAGE, strlen( DEMO_TEXT_MESSAGE ) );
    log_printf( &logger, " The message \"%s\" has been sent!\r\n", ( char * ) DEMO_TEXT_MESSAGE );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
#else
    uint8_t data_buf[ 64 ] = { 0 };
    uint8_t data_len = sizeof( data_buf );
    if ( CCRF_CRC_OK == ccrf_receive_packet( &ccrf, data_buf, &data_len ) )
    {
        log_printf( &logger, " A new message has received: \"" );
        for ( uint16_t cnt = 0; cnt < data_len; cnt++ )
        {
            log_printf( &logger, "%c", data_buf[ cnt ] );
        }
        log_printf( &logger, "\"\r\n" );
    }
#endif
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}


// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.