Closed Fayrewood closed 3 months ago
Is anyone able to help and take a look at the debug logs please? This is driving me nuts. I have tried several CC1101 modules and ESP32 D1 Mini boards and followed the wiring meticulously and checked continuity between the ESP and the CC1101.
I've enabled verbose logging and the ESP is happy up until it tries to run the reset radio in the iboost.h code, just after reporting "SPI OK":
void setup() override {
// This will be called by App.setup()
addressLQI = 255; // set received LQI to lowest value
addressValid=false;
SPI.begin();
Serial.println("SPI OK");
ESP_LOGW(TAG, "SPI OK");
radio.reset();
radio.begin(868.300e6); // Freq=433.2Mhz. Do not forget the "e6"
radio.setMaxPktSize(61);
radio.writeRegister(CC1101_FREQ2, 0x21); // 868.300MHz (868300000 <<16)/26000000
radio.writeRegister(CC1101_FREQ1, 0x65);
radio.writeRegister(CC1101_FREQ0, 0x6a);
radio.writeRegister(CC1101_FSCTRL1, 0x08); // fif=203.125kHz
radio.writeRegister(CC1101_FSCTRL0, 0x00); // No offset
radio.writeRegister(CC1101_MDMCFG4, 0x5B); // CHANBW_E = 1 CHANBW_M=1 BWchannel =325kHz DRATE_E=11
radio.writeRegister(CC1101_MDMCFG3, 0xF8); // DRATE_M=248 RDATA=99.975kBaud
radio.writeRegister(CC1101_MDMCFG2, 0x03); // Disable digital DC blocking filter before demodulator enabled. MOD_FORMAT=000 (2-FSK) Manchester Coding disabled Combined sync-word qualifier mode = 30/32 sync word bits detected
radio.writeRegister(CC1101_MDMCFG1, 0x22); // Forward error correction disabled 4 preamble bytes transmitted CHANSPC_E=2
radio.writeRegister(CC1101_MDMCFG0, 0xF8); // CHANSPC_M=248 200kHz channel spacing
radio.writeRegister(CC1101_CHANNR, 0x00); // The 8-bit unsigned channel number, which is multiplied by the channel spacing setting and added to the base frequency.
radio.writeRegister(CC1101_DEVIATN, 0x47); // DEVIATION_E=4 DEVIATION_M=7 ±47.607 kHz deviation
radio.writeRegister(CC1101_FREND1, 0xB6); // Adjusts RX RF device
radio.writeRegister(CC1101_FREND0, 0x10); // Adjusts TX RF device
radio.writeRegister(CC1101_MCSM0, 0x18); // Calibrates whngoing from IDLE to RX or TX (or FSTXON) PO_TIMEOUT 149-155uS Pin control disabled XOSC off in sleep mode
//radio.writeRegister(CC1101_MCSM1, 0x00); // Channel clear = always Return to idle after packet reception Return to idle after transmission
radio.writeRegister(CC1101_FOCCFG, 0x1D); // The frequency compensation loop gain to be used before a sync word is detected = 4K The frequency compensation loop gain to be used after a sync word is Detected = K/2 The saturation point for the frequency offset compensation algorithm = ±BWchannel /8
radio.writeRegister(CC1101_BSCFG, 0x1C); // The clock recovery feedback loop integral gain to be used before a sync word is detected = KI The clock recovery feedback loop proportional gain to be used before a sync word is detected = 2KP The clock recovery feedback loop integral gain to be used after a sync word is Detected = KI/2 The clock recovery feedback loop proportional gain to be used after a sync word is detected = KP The saturation point for the data rate offset compensation algorithm = ±0 (No data rate offset compensation performed)
radio.writeRegister(CC1101_AGCCTRL2, 0xC7); // The 3 highest DVGA gain settings can not be used. Maximum allowable LNA + LNA 2 gain relative to the maximum possible gain. Target value for the averaged amplitude from the digital channel filter = 42dB
radio.writeRegister(CC1101_AGCCTRL1, 0x00); // LNA 2 gain is decreased to minimum before decreasing LNA gain Relative carrier sense threshold disabled Sets the absolute RSSI threshold for asserting carrier sense to MAGN_TARGET
radio.writeRegister(CC1101_AGCCTRL0, 0xB2); // Sets the level of hysteresis on the magnitude deviation (internal AGC signal that determine gain changes) to Medium hysteresis, medium asymmetric dead zone, medium gain Sets the number of channel filter samples from a gain adjustment has been made until the AGC algorithm starts accumulating new samples to 32 samples AGC gain never frozen
radio.writeRegister(CC1101_FSCAL3, 0xEA); // Detailed calibration
radio.writeRegister(CC1101_FSCAL2, 0x2A); //
radio.writeRegister(CC1101_FSCAL1, 0x00); //
radio.writeRegister(CC1101_FSCAL0, 0x1F); //
radio.writeRegister(CC1101_FSTEST, 0x59); // Test register
radio.writeRegister(CC1101_TEST2, 0x81); // Values to be used from SmartRF software
radio.writeRegister(CC1101_TEST1, 0x35); //
radio.writeRegister(CC1101_TEST0, 0x09); //
radio.writeRegister(CC1101_IOCFG2, 0x0B); // Active High Serial Clock
radio.writeRegister(CC1101_IOCFG0, 0x46); // Analog temperature sensor disabled Active High Asserts when sync word has been sent / received, and de-asserts at the end of the packet
radio.writeRegister(CC1101_PKTCTRL1, 0x04); // Sync word is always accepted Automatic flush of RX FIFO when CRC is not OK disabled Two status bytes will be appended to the payload of the packet. The status bytes contain RSSI and LQI values, as well as CRC OK. No address checkof received packages.
radio.writeRegister(CC1101_PKTCTRL0, 0x05); // Data whitening off Normal mode, use FIFOs for RX and TX CRC calculation in TX and CRC check in RX enabled Variable packet length mode. Packet length configured by the first byte after sync word
radio.writeRegister(CC1101_ADDR, 0x00); // Address used for packet filtration. Optional broadcast addresses are 0 (0x00) and 255 (0xFF).
static uint8_t paTable[] = {0xC6, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F};
radio.writeBurstRegister(CC1101_PATABLE, paTable, sizeof(paTable));
radio.strobe(CC1101_SIDLE); //
radio.strobe(CC1101_SPWD); //
Serial.println("Radio OK");
radio.setRXstate(); // Set the current state to RX : listening for RF packets
Serial.println("Radio RX OK");
// LED setup. It is importand as we can use the module without serial terminal
pinMode(LED_BUILTIN, OUTPUT);
Serial.println("Setup Finished");
ESP_LOGW(TAG, "Setup Finished");
}
You're using a custom component, so this is not the right place. Something in there is taking too long. You also shouldn't be using Serial
.
If you need more help, then come ask on the esphome discord server or one of the forums.
The problem
I am running a D1 Mini with JNSwanson's excellent CC1101 decoder, but my ESP32 gets stuck in a boot loop and I can't fathom out why. I have asked in that forum, but thought I may get a larger support group here. I have double checked all of the connections and continuity between the ESP32 and the CC1101.
The pin connections are below and I get the same error if I remove the CC1101 connections:
Is anyone able to decode the log output and point me in the right direction as to what is happening please?
Log at boot, after a boot loop:
Decoder Information:
Here's the relevant YAML for the device:
Which version of ESPHome has the issue?
2024.7.3
What type of installation are you using?
Docker
Which version of Home Assistant has the issue?
No response
What platform are you using?
ESP8266
Board
D1 Mini
Component causing the issue
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response