Sending the Time.now() long value from Boron over the RX/TX pins to an OpenMV

Hi,

So I have an OpenMV H7 sending a string value from its MISO/MOSI pins (P0 and P1) to the Boron's RX/TX Pins, which the Boron reads in its main loop() using: String statement = Serial1.readString(). This works great. Then the Boron enters a publish state using cellular.

During this publish state, I want the Boron to send its long Datetime value to the OpenMV. I have 2 questions:

  1. Is it possible to send the datetime (the long value from Time.now()) through the same RX/TX pins that are already being used, or is it necessary to use a separate set of pins? Both devices are using baudrate of 9600.
  2. To send the long value, what function can I use? Would Serial1.write() work?

Thank you!

I don't know the specifics of interfacing with that board over serial, and with a quick search I didn't see a standardized serial interface. I'm guessing you're sending some sort of data from the OpenMV board via custom Python code to the Particle board?

In that case, you just need to implement the opposite direction as the serial interface is bidirectional. You need to pick a format and whether you want to create a more complex protocol so you can add more features later.

For example, a time value could be sent:

  • As four binary bytes, in little-endian byte order (natural byte order for Boron)
  • As four binary bytes, in big-endian byte order (network byte order)
  • As 8 hexadecimal digits
  • As a decimal number converted to an ASCII string, possible with a line terminator
  • Using a command-style interface, like AT commands, in ASCII
  • In a string format, such as ISO-8601 ("YYYY-MM-DDTHH:MM:SSZ")

In any case, the way you do it would depend on the format you are using. It could be using the Serial1 write, print, or printf commands.

1 Like

Just updating this for anyone else who potentially has this issue. I found that this is what worked the best for me for the Boron firmware - basically I restarted the Serial1 which helped and used Serial1.print() instead of Serial1.write():

String statement = Serial1.readString(); //reads the data from the OpenMV camera 
Serial.println(statement); 
real_time = Time.now();

Serial1.end();
delay(1000);
Serial1.begin(9600);
Serial1.print(real_time); //Boron sends its datetime to the OpenMV cam
Serial.println(real_time);