LSatan / SmartRC-CC1101-Driver-Lib

This driver library can be used for many libraries that use a simple RF ASK module, with the advantages of the cc1101 module. It offers many direct setting options as in SmartRF Studio and calculates settings such as MHz directly.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation problem with the TFT_eSPI library

JVRMTS opened this issue · comments

commented

This library conflicts with TFT_eSPI, to solve it I had to change the "spi" variable to "ccspi" in the library, since it conflicted with the spi class of TFT_espi, if you modify it it will help many people who use both libraries.

@JVRMTS - I just did the same thing and was going to post about it. However I still have a problem that when my CC1101 is connected at same time as the TFT, calling the init locks my program up. It can not init the CC1101 - did you have a similar problem?

commented

Yes, I have the same problem.

Yes, I have the same problem.

@JVRMTS for what it's worth, I found a different issue thread here that said use a diff SPI config. If you're using an ESP32 like I am you can pretty much use ANY pins for the SPI config just pass them to the function.

I'm using an MH-ET Live ESP32 MiniDevKit for my project (https://doc.riot-os.org/group__boards__esp32__mh-et-live-minikit.html) , I'm using these pins:

#define CC1101_SCK     14
#define CC1101_MISO    26
#define CC1101_MOSI    13
#define CC1101_CS      17
#define CC1101_GDO0    16
#define CC1101_GDO2    34

#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS   15 
#define TFT_DC   33
#define TFT_RST  27
#define TOUCH_CS 12

The TFT, Touch and SD card all work perfectly and so does the CC1101 now it's on it's own SPI bus!

commented

I have solved it by connecting a 100 microF capacitor and a 10K resistor in series with the CC1101 power supply, to delay the CC1101 power supply and when I restart it I no longer have any problem

I have solved it by connecting a 100 microF capacitor and a 10K resistor in series with the CC1101 power supply, to delay the CC1101 power supply and when I restart it I no longer have any problem

@JVRMTS is yours working well?

As soon as I use ELECHOUSE_cc1101.CheckRxFifo(0) or if ((ELECHOUSE_cc1101.SpiReadStatus(CC1101_MARCSTATE) & 0x0F) == 0x01) { ELECHOUSE_cc1101.SetRx(); }

it kills the TOUCH part of my code. Touch no longer responds. If I don't use those (so basically the cc1101 does nothing but the init) then touch works great. As soon as either of those 2 run, it stops responding. The TFT itself still works and responds/updates it's just the touch stops working :(

So annoying - and my CC1101 isn't even on the same SPI as the touch

commented

I keep doing tests, when I have something clear I will post it
And sorry for my English, I use a translator

commented

Solution in esp32:

`#define aliCC1101 25 //CC1101 power
void configuracionCC1101(){
pinMode(aliCC1101, OUTPUT);
digitalWrite(aliCC1101, LOW);
delay(100);
digitalWrite(aliCC1101, HIGH);
ELECHOUSE_cc1101.Init(); // Debe configurarse para inicializar el cc1101
ELECHOUSE_cc1101.setPA(10); // configure TxPower. Son posibles los siguientes ajustes dependiendo de la banda de frecuencia. (-30 -20 -15 -10 -6 0 5 7 10 11 12) ¡El valor predeterminado es máximo!
ELECHOUSE_cc1101.setMHZ(433.92); // Aquí puede configurar su frecuencia básica. La lib calcula la frecuencia automáticamente (predeterminada = 433,92). El cc1101 puede: 300-348 MHZ, 387-464 MHZ y 779-928 MHZ. Lea más información de la hoja de datos.

// Activamos la transmision en el pin correspondiente .
mySwitch.enableTransmit(pin);

// Configuramos el CC1101 en modo transmisión.
ELECHOUSE_cc1101.SetTx();

// Seleccionamos el protocolo de transmisión.
mySwitch.setProtocol(6);

// Seleccionamos tiempo del pulso en la transmisión.
mySwitch.setPulseLength(390);

// Numero de repeticiones de transmisión. En mi caso con 2 es suficiente.
mySwitch.setRepeatTransmit(2);
}
void setup{
configuracionCC1101();
}`

I power the CC1101 through the GPI025, and delay it 100 milliseconds in the setup
Try it and tell me if it works for you too.

They are both on the same SPI

commented

Other solution:

in void setup(){
// load TFT configuration first

// then load the CC1101 configuration
}

This is how everything also works in the same SPI

@JVRMTS I Appreciate the help and comments :)

My current issue is that, for the most part it works, my screen shows what I want, and it continues to update the screen with information. The CC1101 is receving the information correctly and then displaying the results on screen.
The initial setup etc all seems to work

My problem is that as soon as it handles a packet of data it received (using ELECHOUSE_cc1101.CheckRxFifo(0) as needed - suddenly Touch stops working. Touch works fine UNTIL the CC1101 does something, so clearly the library is causing problems still somehow :/

For what it's worth too, I'm only receiving in my use case scenario, I'm not transmitting anything

commented

To send and receive I use the RCSwitch library, it can be downloaded from the Arduino library manager

To send and receive I use the RCSwitch library, it can be downloaded from the Arduino library manager

I will take a look thanks. I'm using the CC1101 (868 module not 433 movule) to read IZAR packets from water meter so the decoding of data etc is custom stuff I've written. I will look at the RCSwitch library to see if I can make use of it - my problem will be if it uses the same FIFO function from this lib I will probs still have the same problem I suspect.

UPDATE: Ok, I managed to get it all working perfectly (albeit using CC1101 on it's own SPI).
I modified the library - I've uploaded my modified library here. All it does it create an HSPI class, and replace any SPI.function() type call with hspi->function() and keeps all SPI related stuff on it's own SPI Bus

SmartRC-CC1101-Driver-Lib-JT.zip

Following the ESP32 SPI example found here:
https://github.com/espressif/arduino-esp32/blob/master/libraries/SPI/examples/SPI_Multiple_Buses/SPI_Multiple_Buses.ino

Which talks about different SPI busses etc, I modified the library to make use of the otherwise unused "HSPI"