Closed Portia-Lin closed 4 years ago
They should work together, depending on a couple things.
Best case scenario, you have the GPIOs and SPI peripherals available and you put each on it's own SPI bus.
The more common way is to put each the display and the LoRa module on the same MISO, MOSI, CLK pins and give each device a Chip Select (CS) pin.
If you post more about what board, display, wiring, etc you're using more specific suggestions can be made.
One SPI master for 2 SPI slaves. Will work as SPI only set a SS low (active) when needed.
However, still have a slim chance that the display is receiving data and LoRa may miss the RX packet?
I only have one SPI bus. Let's say, lora does not always receive signals. But immediately after receiving the signal I want to display the information on the ST7735 screen and receive signals again. I assigned different CS pins for the screen and lora. But will there be no conflict?
Here is a diagram of the device: Morningstar.pdf And sketch:
```
#include
However, still have a slim chance that the display is receiving data and LoRa may miss the RX packet?
Not sure, I suspect this will vary from system to system. In theory two SPI instances, with different CS
pins should wait on one another, but I'm not familiar enough with the Arduino SPI internals to say for sure.
I assigned different CS pins for the screen and lora. But will there be no conflict?
Same applies, SPI is a shared bus peripheral, meaning it was designed to have multiple devices share the MISO, MOSI & CLK pins. This is exactly the function of the CS
pin, it's to specify which device you want to talk to.
I mean, I need to manually set down the lora cs pin before displaying the information on the screen, and set up it after the output. Is it done automatically? I don't quite understand how lora.begin() works.
@Portia-Lin : By right, you don't need to set the CS/SS of LoRa HIGH (Disabled). In this library, the lib will set the CS/SS or the LoRa Low ON-DEMAND. The lib only sets the CS/SS LOW (Active) only when it needs to communicate to the LoRa via SPI.
Of course, you could.
I assembled the bread board and I'm sure it's connected properly. I use a standard LoRa Sender sketch. But I modified the LoRa Receiver by adding a screen to the sketch. Packages arrive correctly, but the screen cannot display them. It feels like it can't be initialized. Attached a sketch. And the video shows the behavior of the display. I am seriously concerned about this problem. This should be part of my thesis ...
```
#include
YouTube video link May I have made a mistake in the code, but it seems to me that it is correct.
Maybe the screen does not have time to display information, and lora takes control? Maybe need some delay before lora receiving?
You need to use an oscilloscope or a logic analyzer to figure out what your /CS pins are doing...
Thanks for your answers. But I do not have such equipment(
Delay doesn't help. Maybe disable lora when displaying information and after enable again? How to do that in sketch?
Does your LCD work if you don’t initialize LoRa?
Yes, if lora initialisation fails i can displaying text
Have you tried setting the /CS pins manually? Set LoRa /CS low, then call your LoRa routines, then set it high, and LCD /CS low, then call your LCD routines? Don’t pass the /CS pins into the LoRa or LCD driver - handle them yourself and see what happens.
@beowulff If you check the source code, this lib will set _ss to LOW or HIGH when it needs to talk to sx1278. So if you set the ss, no use, will be overwritten.
May be can put the LoRa to sleep instead? LoRa.sleep()
I tried use LoRa.sleep() before display initialisation. Then i initialize the display and display random text. This doesn`t work... Then i tried use LoRa.sleep() and set lora /CS to high, iniyialise display and set TFT /CS to high. Whole code i put into the setup(), therefore, it was performed only once. But everything I did didn't work. The display blinked, similar to the initialization, but did not display text. I think my project is dead
Don’t give up! I’m sure this is solvable. Put an LED on each device’s /CS line - Anode of the LED to 3.3v, Cathode connected to the /CS line, with a 200Ω - 1kΩ resistor in series, and see if you can tell the state of the /CS line that way. The LEDs should light up when the /CS line is selected. Use high-brightness LEDs to be able to detect short pulses.
I think I have success. The display does not work properly if it is connected to analog outputs arduino nano. But I listed them as digital, I don`t understand this. THANKS YOU ALL for yours answers and patience. Now everything works properly. Attached sketches that I use and video demonstrations
```
#include
```
#include
and sorry for my english...
Very cool! Glad you got it working. And, welcome to the wonderful, weird world of embedded computing.
Thank you very much for your help!
I connected the module to the Arduino board. also i want to connect a graphic display via spi interface. Will lora affect the display information on the SPI display? I use it as a receiver and it is probably always active. I want to display the received message after it has been received. What should i do?