-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing RA-02 SX1278 module with STM32L031 #8
Comments
Hello char send_data[20];
snprintf(send_data, 6, "Hello!");
LoRa_transmit(&myLoRa, (uint8_t*)send_data, 6, 100); I think this should solve your problem. |
@SMotlaq I have updated the transmitter code as you have suggested but im afraid not much changed. I believe issue lies in the receiver code. Something is not right. The receiver is constantly printing garbage even when I dont have transmitter powered. |
Please send me your project and codes |
@SMotlaq All you need to do is to update :
depending on which mode you want to program the device Additionally, I have put a scope on the DIO0 pin on the receiver device. It is never triggered but on the console it prints the received garbage data. Does your receiver code utilize DIO0 rx interrupt?. I was under the impression that data received should only be printed when the RX interrupt is triggered. On my STM32, the DIO0 is configured as input pin and is pulled down. (You can check my CubeMX configuration) |
Have you checked what value LoRa_init() function returns? |
Yes. I have added the following to my code:
and the result:
|
If it would be helpful, I can connect logic analyzer to SPI pins and check what happens |
1- Please reset the buffer first, using uint8_t received_data[10];
memset(received_data, NULL, 10); 2- Also please send a variable data from sender. For example "Hello 1", "Hello 2", ... 3- Print the exact values of the |
@SMotlaq
and my transmitter code as following:
As you can see lora receiver receives strange data. This data is being does not have anything to do with my lora transmitter since it will keep receiving:
Even when my transmsitter is powered OFF. I have updated my git repository for this project if you want to have a look at the latest code. |
I will run your code on my hardware as soon as possible and tell you the result. |
Sounds good. Please let me know if you are able to reproduce the issue at all. :) |
@SMotlaq Perhaps my issue is related to this? |
@SMotlaq |
When the module receives a valid LoRa packet, it changes the DIO0 from LOW to HIGH (I don't know how long this pin stays HIGH). You can enable an EXTI in the rising edge mode to detect arriving packets. You didn't use interrupts in your code, so I don't think that is the reason of your problem. But you can test it. The polling mode is not recommended. It's better than using interrupts. |
I will try to receive using EXT interrupt and post back the results |
I am trying to get this example project working on the STM32L031 development board:
https://www.st.com/en/evaluation-tools/nucleo-l031k6.html
I cannot fully understand how am I intended to test this. I have 2 identical STM32L031 devices and connected each STM32L031 to the RA-02 SX1278 lora module.
One is running LoRa transmit code:
The other is running receive code:
The logs side by side:
![image](https://private-user-images.githubusercontent.com/22237034/257418170-1589337e-9dc3-4ec6-a5e9-b80edefc1eaa.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM4NDc5NjIsIm5iZiI6MTcyMzg0NzY2MiwicGF0aCI6Ii8yMjIzNzAzNC8yNTc0MTgxNzAtMTU4OTMzN2UtOWRjMy00ZWM2LWE1ZTktYjgwZWRlZmMxZWFhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE2VDIyMzQyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRmMzgyY2ZmNTBjYWI2NjA0MjkxNmFhNmIxMGM5ZWY1YWUxNmQ2Y2RjNGE0YTEyOWMwMDk2MWNjNTFkODg0ODAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.rIHVYffIIQALEPuHtXIXmPNA0_FlMfA8RSp0CbYV64s)
Is that the expected behaviours of this library?
How to ensure I receive the correct data?
Is it normal that it fails to transmit every now and then?
The text was updated successfully, but these errors were encountered: