Portenta Machine Control RS232 Communication

Hi everyone, I am definitely exposing a stupid problem but due to my poor experience with the new Portenta Board I am wasting too much time looking for a solution. Here is my problem: I have to interface a Grove SIM 28 GPS location card with serial communication set by default at 9600 baud.
The first test I did it by connecting to an Arduino Mega and the response received on the serial was perfect. By connecting the GPS card to the serial on Arduino PMC, reading the data received on the serial, I have totally inconsistent values compared to those received on the Arduino Mega. The GPS board is connected as follows: Vcc -> 3V3 (Grove Connector), GND -> GND, Tx -> RXP485, Rx -> At the moment not used.
The sketch is obtained from the RS232 example present in the Machine Control library.

#include <Arduino_MachineControl.h>

using namespace machinecontrol;

void setup()
{

    for (auto const timeout = millis() + 2500; !Serial && timeout < millis(); delay(500))
        ;
   
  delay(2500);
  Serial.println("Start RS232 initialization");
  Serial.println("Initialization done!");
    // Set the PMC Communication Protocols to default config
    comm_protocols.init();

    // RS485/RS232 default config is:
    // - RS485/RS232 system disabled
    // - RS485 mode
    // - Half Duplex
    // - No A/B and Y/Z 120 Ohm termination enabled

    // Enable the RS485/RS232 system
    comm_protocols.rs485Enable(true);
    // Enable the RS232 mode
    comm_protocols.rs485ModeRS232(true);
    
    // Specify baudrate for RS232 communication
    comm_protocols.rs485.begin(9600);
    // Start in receive mode
    comm_protocols.rs485.receive(); 
}

void loop() {
  
 if (comm_protocols.rs485.available())
 Serial.println(comm_protocols.rs485.read());
    }

You seem to be missing a Serial.begin(...)

The for loop at the beginning of setup() doesn't look correct with respect to timeout.
Take a look at the "blink without delay" built in example sketch for the correct way to check for timeouts using millis().

Dear Arduarn, thanks for yout reply, you right I miss Serial.begin(), probably lost it during the milion test I'm doing. Anyway now I add it and I remove the 'for' cycle timeout (was just a copy paste from the example RS232 project) but situation is the same. The effect of the problem seems the same as with an incorrect serial port configuration, data is received but not in the desired sequence.
I'm probably omitting something for proper serial port configuration or handling of received data in a correct way. Thanks for your feedback!

#include <Arduino_MachineControl.h>
using namespace machinecontrol;


void setup()
{
  Serial.println("Start RS232 initialization");
  Serial.println("Initialization done!");
    // Set the PMC Communication Protocols to default config
    comm_protocols.init();

    // RS485/RS232 default config is:
    // - RS485/RS232 system disabled
    // - RS485 mode
    // - Half Duplex
    // - No A/B and Y/Z 120 Ohm termination enabled

    // Enable the RS485/RS232 system
    comm_protocols.rs485Enable(true);
    // Enable the RS232 mode
    comm_protocols.rs485ModeRS232(true);
    

    // Specify baudrate for RS232 communication
    comm_protocols.rs485.begin(9600);
    Serial.begin(9600);
    // Start in receive mode
    comm_protocols.rs485.receive();
}

void loop() {
 if (comm_protocols.rs485.available())
 Serial.print(comm_protocols.rs485.read());
}

I'm not familiar with your hardware, however it sounds like the GPS board is outputting TTL serial (which easily interfaces with the Mega) but the PMC has genuine RS-232 inputs and expects genuine RS-232 voltage levels which are totally different.

You'll need to use a TTL serial to RS-232 converter module.

I think you are absolutely right, I naively thought that PMC's RS232 was able to handle TTL signal too, but it isn't. I have already ordered a converter and will be able to test it tomorrow. I'll update you as soon as I'm done. Thanks a lot.

Dear arduarn, just try with RS232 converter, everything work perfectly! Thanks!!!!

Good stuff. Appreciate the update, thanks.