UART communication with SARA AFF R410

Hello,
I am starting up a small project with the SARA AFF R410 and it was a long time since I played with it and i need some help.
I am just trying to set up an UART communication to a HM-10 Bluetooth chip. I have connected the board by soldering it to the TX/RX ports of the Sodaq card. But I am having some issues with the arduino code.
From what I understand I should just change the same passthrough code to use the serial input instead of serial1.

#if defined(ARDUINO_SODAQ_SARA)
/* SODAQ SARA */
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial

#else
#error “Please select the SODAQ SARA as your board”
#endif

unsigned long baud = 9600;

void setup()
{
pinMode(SARA_ENABLE, OUTPUT);
pinMode(SARA_TX_ENABLE, OUTPUT);
pinMode(SARA_R4XX_TOGGLE,OUTPUT);
pinMode(PAD_SERIAL_TX,OUTPUT);
pinMode(PAD_SERIAL_RX,INPUT);

digitalWrite(SARA_ENABLE,HIGH);
digitalWrite(SARA_TX_ENABLE,HIGH);
digitalWrite(SARA_R4XX_TOGGLE,LOW);

// Start communication
SerialUSB.begin(baud);
Serial.begin(baud);

}

// Forward every message to the other serial
void loop()
{
while (SerialUSB.available())
{
Serial.write(SerialUSB.read());
}

while (Serial.available())
{
SerialUSB.write(Serial.read());
}
}

What am I doing wrong?

Best regards/
Joel

Hi Joel,

Do you power the HM-10 Bluetooth separately?
If yes, do you have a common ground? Just solder a wire from the HM-10 GND to a GND pin on the sara board.

Best regards,
Jan

Yes so the connected pins are 5V, GND, TX, RX.

But in comment to your response I guess you dont see any problem with the code?

Hi Nubuino,

What kind of HM-10 do you have?
Martyn has some excellent information here.
http://www.martyncurrey.com/hm-10-bluetooth-4ble-modules/
He notes that to get started just supply 5V and GND and you should be able to see it when scanning with your phone.

Also make sure to check your version, newer versions default to a baudrate of 115200.

Regards,
Thom

Hi Thom I am not sure, my card doesn’t look exactly like the pictures you sent me. But I can definitely see that the card is scanning it is blinking red. But I need to communicate with the device since I want to be able to change some settings on it!

But you dont see any problem with the code so atleast I can check that the passthrough code is not the problem? Maybe I am using a HM-10 which is a copy of the real HM-10…

Best regards,
Joel

Hi Nubuino,

You code looks fine, just make sure to try 115200. You can remove the power switches in your setup as they don’t do anything.

You can reference it against our passthrough.
https://learn.sodaq.com/Boards/Sara_AFF/Examples/passthrough/

Regards,
Thom