I am having a very hard time communicating with the Iridium RockBLOCK module via SerialPort.
I tried Serial1, Serial2, although I need to talk to it thru Serial5.
This is the Developer Guide from the iridium modem.
I really can’t seem to find a problem, I tried writing code from a lot of angles, and this is the simplest I can try. This is a passthru sample, but I also tried a direct Print(“AT”) code.
All I get back is some weird characters and sometimes echo (which isn’t supposed to be). I doubled check baud rates, cables (TX in Block7 is supposed to be connected to TX in Arduino and not cross like expected) [I tried inverting it anyway without luck]). I send AT and I get weird characters.
The Rock7 is powered by the 3.7 battery directly using the li+ connection in the block. If I use an Arduino the device works as expected. It is a 5v module though. I might have some level issues… But I am not sure!
Here is my sample code:
#include "Serial5/Serial5.h"
SYSTEM_MODE(SEMI_AUTOMATIC);
void setup()
{
Serial.begin(9600);
Serial5.begin(19200, SERIAL_8N1);
delay(1000);
}
String NewCommand = "";
void loop()
{
while(Serial.available())
{
char c = Serial.read();
NewCommand += c;
if(c == '\n') {
NewCommand.remove(NewCommand.indexOf('\n'));
NewCommand.remove(NewCommand.indexOf('\r')); //Removing all characters just in case
Serial5.print(NewCommand + "\n\r"); //Rockblock 7 needs /r not /n.. tried it both ways
NewCommand = "";
}
}
while(Serial5.available())
{
char c = Serial5.read();
Serial.print(c);
}
}
I am really pulling my hair! I am thinking this is a hardware issue or something stupid I am missing.
UPDATE:
I found that the UART pins are NOT 5v tolerant. I don’t know why I thought they where but they are not specified like that on the data sheet on a second read, I hope I haven’t blown the electron IO yet. Will try a level shifter and report back…
UPDATE2:
Indeed there was level shifting required. I made a test with a couple of MOSFETS and ti work. Now waiting for a better board for shifting from SparkFun.