SmartRF Studio 7 version 2.18
CC1101 + SmartRF04eb + Arduino Uno
Synchronous serial mode, 4-FSK modulation
RXFIFO_OVERFLOW error when selecting continuous rx/synchronous serial mode and 4-FSK modulation format.
In RF device command screen clicking read rx fifo returns nothing. After SRES/SFRX command strobes still overflow error.
https://i.ibb.co/2P1Rk9x/rxfifo-overflow.jpg
When selecting 2-FSK and while RX is executing (Start button clicked), it is possible to change the modulation format to 4-FSK without overflow error. Menu item settings -> log to file, log file content when changing 2-FSK to 4-FSK.
13:38:38.088 MDMCFG2 0x00 2 W
13:38:38.103 FREND0 0x10 2 W
13:38:40.807 MDMCFG2 0x40 2 W
13:38:40.807 FREND0 0x10 2 W
https://i.ibb.co/qMPkds1/fsk4run.jpg
I tested this with two setups: CC Debugger + CC1101 and SmartRF04EB + CC1101.
Arduino code for receiving clock/data. IOCFG2 (serial clock) connected to Arduino digital pin 3 and IOCFG0 (serial data) connected to Arduino digital pin 2. CC1101 carrier sense signal should be connected also, but my CC1101 module has only GDO0 and GDO2 pins.
#define GDO0_PIN 2
#define GDO2_PIN 3
#define DATA_SIZE 64
#define pinOfPin(P)\
(((P)>=0&&(P)<8)?&PIND:(((P)>7&&(P)<14)?&PINB:&PINC))
#define pinIndex(P)((uint8_t)(P>13?P-14:P&7))
#define pinMask(P)((uint8_t)(1<<pinIndex(P)))
#define isHigh(P)((*(pinOfPin(P))& pinMask(P))>0)
#define isLow(P)((*(pinOfPin(P))& pinMask(P))==0)
#define digitalState(P)((uint8_t)isHigh(P))
uint8_t data[DATA_SIZE];
volatile uint16_t index = 0;
volatile bool printData = false;
void setup() {
Serial.begin(57600);
pinMode(GDO0_PIN, INPUT);
pinMode(GDO2_PIN, INPUT);
memset(data, 0, sizeof(data));
attachInterrupt(digitalPinToInterrupt(GDO2_PIN), isr, FALLING);
}
void loop() {
uint8_t l = 0;
if (printData) {
Serial.print(F("\r\n\r\n"));
for (uint16_t i = 0; i < index; i++) {
Serial.print(data[i], HEX);
l++;
if (l == 31) {
Serial.println();
l = 0;
}
}
index = 0;
printData = false;
}
}
void isr() {
static uint8_t p = 0;
static uint8_t v = 0;
if (!printData) {
// msbfirst (lsbfirst << n;)
v |= digitalState(GDO0_PIN) << (7 - p);
p++;
if (p == 8) {
data[index] = v;
v = 0;
p = 0;
index++;
if (index == DATA_SIZE) {
printData = true;
}
}
}
else {
if (index > 0) {
p = 0;
printData = true;
}
}
}
Kommentit
Tämän blogin kommentit tarkistetaan ennen julkaisua.