How can I combine 2 modules in STM32?

180 views Asked by At

As a newbie, I have a project involving an STM32 Blue Pill microcontroller. The project's objective is to read data from a DHT11 sensor and transmit it via a LoRa module.

Individually, I have successfully tested both modules. I can read data from the DHT11 and send and receive dummy data between two LoRa modules. However, when I attempt to combine these two modules in my project, I encounter issues. Specifically, I can't read data from the DHT11 anymore, and the LoRa module fails to transmit.

I'm using Timer1 to create micro-delays for the DHT11 sensor, and I'm using SPI1 for the LoRa module. Could this be causing a conflict between the two modules?

I attached the pinout: PinOut

I can explain briefly my problem: If I use code only for DHT11, it can read data from the DHT11 perfectly. But when I try to combine with LoRa (RF Lora SX1278 433Mhz Ra-02), it gets stuck at while ((HAL_GPIO_ReadPin (DHT11_PORT, DHT11_PIN))); 2 It never goes to low, and I don't know why :((

Here is my GitHub project : My Project I use the STM32CubeIDE Platform.

1

There are 1 answers

1
dda On

SPI1 is on PA5/6/7. And a LoRa module (which one are you using?) requires a few more GPIOs. So check that the pins you are using for the LoRa module don't conflict with the DHT11 and Timer1. I have STM32 projects with LoRa, I2C, and more, that work flawlessly.

Maybe show some code and a pinout.