Replies: 8 comments 23 replies
-
Freezing after a couple messages were sent seems like a memory issue. Does it only happen with AFSK, or is 2-FSK the same? And does it still happen if you enable
I'm not sure what is the exact setup. Are you transmitting FSK from Uno and not receiving it on Nano BLE? Could you post the code? |
Beta Was this translation helpful? Give feedback.
-
I'm using a very slightly modified version of the AX.25 Transmit AFSK example. We're receiving using a software-defined radio that just plugs into the computer via USB. When we use this code on the Arduino Uno, we get the issue where only some of the packets are received. When we use this code on the Arduino Nano 33 BLE, none of the packets are received. /*
RadioLib AX.25 Transmit AFSK Example
This example sends AX.25 messages using
SX1278's FSK modem. The data is modulated
as AFSK at 1200 baud using Bell 202 tones.
Other modules that can be used for AX.25
with AFSK modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- nRF24
- Si443x/RFM2x
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// SX1278 has the following connections:
// NSS pin: 10
// DIO0 pin: 2
// RESET pin: 9
// DIO1 pin: 3
SX1278 radio = new Module(4, 3, 2, 5);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// create AFSK client instance using the FSK module
// pin 5 is connected to SX1278 DIO2
AFSKClient audio(&radio, 6);
//
//// create AX.25 client instance using the AFSK instance
AX25Client ax25(&audio);
void setup() {
Serial.begin(9600);
// initialize SX1278 with default settings
Serial.print(F("[SX1278] Initializing ... "));
int state = radio.beginFSK(435.0, 1.2, 125.0, 10, 16, false);
radio.setOutputPower(20);
radio.variablePacketLengthMode(SX127X_MAX_PACKET_LENGTH);
uint8_t syncWord[] = {0x12, 0xAD};
radio.setSyncWord(syncWord, 2);
radio.setDataShaping(RADIOLIB_SHAPING_NONE);
radio.setCurrentLimit(60);
radio.setEncoding(RADIOLIB_ENCODING_NRZ);
radio.setCRC(true);
radio.disableAddressFiltering();
radio.setRSSIConfig(2, 0);
//
// when using one of the non-LoRa modules for AX.25
// (RF69, CC1101,, Si4432 etc.), use the basic begin() method
// int state = radio.begin();
if(state == ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
}
// initialize AX.25 client
Serial.print(F("[AX.25] Initializing ... "));
// source station callsign: "N7LEM"
// source station SSID: 0
// preamble length: 8 bytes
state = ax25.begin("EVESF");
if(state == ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
}
// Sometimes, it may be required to adjust audio
// frequencies to match the expected 1200/2200 Hz tones.
// The following method will offset mark frequency by
// 100 Hz up and space frequency by 100 Hz down
/*
Serial.print(F("[AX.25] Setting correction ... "));
state = ax25.setCorrection(100, -100);
if(state == ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
}
*/
}
void loop() {
// // send AX.25 unnumbered information frame
delay(5000);
Serial.print(F("[AX.25] Sending UI frame ... "));
// // destination station callsign: "NJ7P"
// // destination station SSID: 0
int state = ax25.transmit("Hello Anthony! This is test message 0 to see if the radio works. Does it work?", "NJ7P");
delay(100);
state = ax25.transmit("Hello Anthony! This is test message 1 to see if the radio works. Does it work?", "NJ7P");
delay(100);
state = ax25.transmit("Hello Anthony!?", "NJ7P");
delay(100);
state = ax25.transmit("11111111", "EEFD");
delay(100);
state = ax25.transmit("Hello Anthony! This is test message 4 to see if the radio works. Does it work?", "NJ7P");
delay(100);
state = ax25.transmit("Hello Anthony! This is test message 3 to see if the radio works. Does it work?", "NJ7P");
delay(100);
// if (state == ERR_NONE) {
// // the packet was successfully transmitted
// Serial.println(F("success!"));
//
// } else {
// // some error occurred
// Serial.print(F("failed, code "));
// Serial.println(state);
//
// }
//
delay(5000);
} I'm gonna try the static memory thing now. |
Beta Was this translation helpful? Give feedback.
-
Getting a couple errors compiling with
|
Beta Was this translation helpful? Give feedback.
-
I tested with |
Beta Was this translation helpful? Give feedback.
-
As a side note, does RadioLib support receiving AX.25 over AFSK? Looks like receiving support is only there for FSK and LoRa? |
Beta Was this translation helpful? Give feedback.
-
For the issue where we're only getting some of the messages, this is what we're seeing (image). We're trying to send "message 1 tryX" where X counts up from 0, but as you can see we're only getting some of the messages. The ones we're getting are consistent if we re-run the program as well. |
Beta Was this translation helpful? Give feedback.
-
@kazar4 Finally managed to track it down, so the encoding issue should now be fixed. @elaidlaw I tried the original sketch you posted in this discussion and all packets are decoded by soundmodem correctly. |
Beta Was this translation helpful? Give feedback.
-
@kazar4 @elaidlaw So with the Nano BLE, I managed to track down the cause of this hanging. Unfortunately I'm not sure if I will be able to do anything about it. For starters, here's a very simple code snippet demontrating the issue - notice it is not using RadioLib code at all. pinMode(6, OUTPUT);
while(true) {
tone(6, 2200);
delayMicroseconds(833);
tone(6, 1200);
delayMicroseconds(833);
} In theory, this should indefinitely flip between outputting a 1200 Hz and 2200 Hz tone on the pin 6. In reality, this will only work for a couple seconds, and then the Arduino will hang. That does not happen on Uno. The reason is that on Neno 33 BLE, Tone* active_tone = NULL;
void tone(uint8_t pin, unsigned int frequency, unsigned long duration) {
if (active_tone) {
delete active_tone;
}
Tone* t = new Tone(digitalPinToPinName(pin), frequency, duration);
t->start();
active_tone = t;
};
void noTone(uint8_t pin) {
if (active_tone) {
active_tone->stop();
delete active_tone;
active_tone = NULL;
}
}; Every time you call Unfortunately this is not only the case for Nano 33 BLE, but any mbed OS Arduino (e.g. RP2040 or Portenta). I'm going to try a couple things to get it working reliably, but most likely it will involve implementing RadioLib's own |
Beta Was this translation helpful? Give feedback.
-
I'm using an Arduino Nano 33 BLE and RFM96 to send AX.25 packets with AFSK, but after several packets have been sent, the Arduino becomes unresponsive and I have to manually reset it to its bootloader and reupload the sketch before it will work again.
It always fails at the same place in transmission:
Any ideas what might be happening? I saw another post on here about a similar issue and it sounds like you don't have a Nano BLE to try it out on, but if it would help I would be happy to cover the cost for one.
Another thing to note is that we're not actually receiving the packets transmitted using the Nano BLE, whereas we are when using an Uno. Even when we use the Uno though, we're only getting some of the packets. I'm sending the string
"Hello Anthony! This is test message 4 to see if the radio works. Does it work?"
6 times, replacing the number 4 here with 0-5 for each packet respectively. What's super weird is that we consistently receive the same two packets every time the set of six are sent, and none of the others.So two questions: any idea why this happens? (it's possible our receiver has a problem so if you think that's the case just say so) And then why would it not work on the Nano BLE at all?
Beta Was this translation helpful? Give feedback.
All reactions