Open darkdrgn2k opened 5 years ago
Disregard. Compiles fine when M0 board was selected.
Seems i picked up https://www.adafruit.com/product/3078 instead of https://www.adafruit.com/product/3178
any visibility if it will work?
The program will execute fine I believe. However with the significantly slower processor and smaller memory you might eventually run in to timing and memory issues. Please let me know how it goes.
So i had to remove the malloc.h to get it compile.d
I had some issues getting it flashes May be a Linux quirk ill confirm
Is there a way to check if the flash worked?
Confirmed some linux screwy stuff with USB i can now flash it properly with windows.
console getting
!ID SL_testclient 8 slid 124
Doing some debugging seems to die on
sl.init((void *)&slconfig, sizeof(slconfig));
Is it possible you've selected the wrong board (you mentioned selection M0 above)? For the 32u4 board your board selection should be Adafruit AVR boards / Feather 32u4
yes I'm past that point finally
m0 won't flash but uses malloc. h ok 32u4 will flash but needs malloc disabled
I so tested it using blink example to confirm.
That should be okay. I'm guessing it's just a pinout problem like you mentioned above
In the SL_testclient0.ino file, can you make sure you add the right pinout? Your lines 12 on should look something like this:
// for Feather M0
#if 0 // will be removed by compiler
#define RFM95_CS 8
#define RFM95_RST 4
#define RFM95_INT 3
#define LORALED 13
#define VBATPIN A7
#endif
// for feather32u4
#if 1
#define RFM95_CS 8
#define RFM95_RST 4
#define RFM95_INT 7
#define LORALED 13
#undef VBATPIN
#endif
I tried with that, no difference that can be seen. I was hoping there was another pin i was missing or something.
It still stops somewhere in sl.init((void *)&slconfig, sizeof(slconfig));
Traced the error down to void LoRaClass::setFrequency(long frequency)
i had some success using this but does not seem to be
void LoRaClass::setFrequency(long frequency)
{
_frequency = frequency;
// uint32_t frf = ((uint32_t)frequency << 19) / 32000000;
uint32_t frf = 14991360;
writeRegister(REG_FRF_MSB, (uint8_t)(frf >> 16) & 0xff);
writeRegister(REG_FRF_MID, (uint8_t)(frf >> 8) & 0xff);
writeRegister(REG_FRF_LSB, (uint8_t)(frf >> 0) & 0xff);
}
Math is
(915 * 1000000.0) / (32000000.0 / 524288)
Supposedly the driver SHOULD work with this board https://github.com/sandeepmistry/arduino-LoRa/issues/199
i will fork his driver and try it in a more isolated test
I have created a small test program to debug this issue.
I found that the issue is with
_driver->setFrequency(SL_LORA_DEFAULT_FREQUENCY * 1E6);
if it is REPLACED with
if (!_driver->begin(SL_LORA_DEFAULT_FREQUENCY * 1E6)) {
Serial.println("LoRa driver init failed");
while (true);
}
It seems to initalize properly
#include <LoRa.h>
#define RFM95_CS 8
#define RFM95_RST 4
#define RFM95_INT 7
#define SL_LORA_DEFAULT_FREQUENCY 915
LoRaClass *_driver = NULL;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Sleeeping");
delay(1000);
Serial.println("Sleeeping...");
delay(4000);
_driver = new LoRaClass();
_driver->setPins(RFM95_CS ,RFM95_RST, RFM95_INT);// set CS, reset, IRQ pin
_driver->setFrequency(SL_LORA_DEFAULT_FREQUENCY * 1E6)
Serial.println("init 1");
_driver->setSpreadingFactor(7);
Serial.println("init 2");
_driver->setSignalBandwidth(125E3);
Serial.println("init 3");
_driver->setPreambleLength(8);
Serial.println("init 4");
_driver->setCodingRate4(5);
Serial.println("init 5");
_driver->enableCrc();
if (!_driver->begin(SL_LORA_DEFAULT_FREQUENCY * 1E6)) {
Serial.println("LoRa driver init failed");
while (true);
}
Serial.println("LoRa Initialized\n");
}
void loop() {
// put your main code here, to run repeatedly:
}
When i moved the line up in SteamLink the module initialized. It returned an error but im not sure if that is of concern.
!ID SL_testclient 8 slid 122
Init
Init Done
Steamlink init done
| OP : 35
| SLID : 290 <-> HEX: 122
SteamLinkGeneric::generic_send: send failed!!
Sending "Button 0 pkt: 1"
SteamlinkGeneric::send_data Warning: cannot send ADMIN and USER packets while waiting for ACK
send failed
| OP : 35
| SLID : 290 <-> HEX: 122
SteamLinkGeneric::generic_send: send failed!!
| OP : 35
| SLID : 290 <-> HEX: 122
SteamLinkGeneric::generic_send: send failed!!
| OP : 35
| SLID : 290 <-> HEX: 122
SteamLinkGeneric::generic_send: send failed!!
Confirmed with SDR that chirps are being generated
Forked and made changes (in prep for a PR) https://github.com/steamlink/steamlink-arduino/compare/master...darkdrgn2k:master
https://github.com/steamlink/steamlink-arduino/blob/ffd3f7a203f07fab3189a8ba83a4f1c906c07a70/SL_RingBuff.cpp#L2
Seems arduino does not like this.
Commented it out things compile.
Possibly it was supposed to be
#ifdef UNIX
instead?