Arduino Leonardo compatibility issue on LattePanda?

userHead GuildWorks 2020-07-11 02:13:35 942 Views1 Replies
TEST PLATFORMS: Windows LattePanda 2gb/32gb, as well as 4gb/64gb, with Arduino Uno and Arduino Mini Pro for comparison.

PROJECT: Simple FM receiver. The packet reception is as expected when tested on several variants of Arduino Uno. On LattePanda with integrated Arduino Leonardo, receiving only about 1/5th of the packets compared to side-by-side testing with Arduino Uno; swapping FM receivers, cabling hasn't helped. Tried two different LattePandas, both showing the same diminished results of missing packets. There was an interesting investigation here about the Leonardo and serial port issues: https://www.lattepanda.com/topic-f6t1429.html?start=20, but that didn't exactly help my situation.

Tried multiple power adapters with the LattePanda, but that didn't help. Interestingly, using 5v and Ground from an Arduino Uno to power the FM receiver that is connected to the data pin of the LattePanda yields the proper results of perfect packet reception.

Here's the source code:
/* source: https://dronebotworkshop.com */
// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library
#include <SPI.h>
// Create Amplitude Shift Keying Object
RH_ASK rf_driver;

void setup()
{
// Initialize ASK Object
rf_driver.init();
// Setup Serial Monitor
Serial.begin(9600);
}

void loop()
{
// Set buffer to size of expected message
uint8_t buf[24];
uint8_t buflen = sizeof(buf);
// Check if received packet is correct size
if (rf_driver.recv(buf, &buflen))
{

// Message received with valid checksum
Serial.print("Message Received: ");
Serial.println((char*)buf);
}
}