![](/media/cache/profiles/TAG-avatar.png.50x50_q85.png)
Demo of how to use CC1200 radios to send data.
CC1200 Example Project
This project shows how to use my Mbed OS CC1200 driver to send messages over the air. It connects to the radio chips, configures them (using a couple of different configurations converted from SmartRF), and sends a message from a transmitter chip to a receiver.
Hardware Setup
This program assumes that two CC1200s are connected to your processor's SPI bus. The CC1200s' circuit boards must be configured for the 900MHz band. Also, if you are connecting the two radios together directly with a cable, make sure to include an attenuator (-20dB should work) to prevent overloading the radios' RX inputs.
I used a custom circuit board for my testing, but you should also be able to use an Mbed board connected to two CC1200 eval kits to run the program.
Note: License free transmission on the 900MHz band is only legal in Region 2 countries (North and South America). Make sure to follow all local regulations covering radio transmissions!
Diff: TestCC1200.cpp
- Revision:
- 2:ff257762763e
- Parent:
- 1:7e7812669c9c
diff -r 7e7812669c9c -r ff257762763e TestCC1200.cpp --- a/TestCC1200.cpp Fri Aug 28 16:15:10 2020 -0700 +++ b/TestCC1200.cpp Mon May 03 02:44:55 2021 -0700 @@ -70,13 +70,14 @@ float symbolRate; float rxFilterBW; CC1200::ModFormat modFormat; - uint8_t ifCfg = 0b101; // max IF + CC1200::IFCfg ifCfg = CC1200::IFCfg::POSITIVE_DIV_8; bool imageCompEnabled = true; bool dcOffsetCorrEnabled = true; uint8_t agcRefLevel; uint8_t dcFiltSettingCfg = 1; // default chip setting uint8_t dcFiltCutoffCfg = 4; // default chip setting + uint8_t agcSettleWaitCfg = 2; CC1200::SyncMode syncMode = CC1200::SyncMode::SYNC_32_BITS; uint32_t syncWord = 0x930B51DE; // default sync word @@ -99,7 +100,7 @@ fskDeviation = 399169; symbolRate = 500000; rxFilterBW = 1666700; - ifCfg = 0; + ifCfg = CC1200::IFCfg::ZERO; imageCompEnabled = false; dcOffsetCorrEnabled = true; modFormat = CC1200::ModFormat::GFSK_4; @@ -112,6 +113,7 @@ rxFilterBW = 104200; modFormat = CC1200::ModFormat::GFSK_2; agcRefLevel = 0x27; + agcSettleWaitCfg = 1; } else if(config == 4) { @@ -138,9 +140,8 @@ radio.setSymbolRate(symbolRate); radio.setOutputPower(txPower); radio.setRadioFrequency(band, frequency); - radio.setIFMixCFG(ifCfg); + radio.setIFCfg(ifCfg, imageCompEnabled); radio.configureDCFilter(dcOffsetCorrEnabled, dcFiltSettingCfg, dcFiltCutoffCfg); - radio.setIQMismatchCompensationEnabled(imageCompEnabled); radio.setRXFilterBandwidth(rxFilterBW); radio.configureSyncWord(syncWord, syncMode, syncThreshold); radio.configurePreamble(preableLengthCfg, preambleFormatCfg); @@ -148,7 +149,8 @@ // AGC configuration (straight from SmartRF) radio.setAGCReferenceLevel(agcRefLevel); radio.setAGCSyncBehavior(CC1200::SyncBehavior::FREEZE_NONE); - if(ifCfg == 0) + radio.setAGCSettleWait(agcSettleWaitCfg); + if(ifCfg == CC1200::IFCfg::ZERO) { radio.setAGCGainTable(CC1200::GainTable::ZERO_IF, 11, 0); }