Connecting to ArduinoCloud with new 4G module

@vdbergw are you using the cloud editor? or the desktop IDE? which renesas_portenta core version are you using?

Portenta_core version 1.2.0, rolled back to 1.0.5 and tested each release between them.
All had the same result.

Tried both desktop IDE and cloud editor, no difference.
Serial1_RTS stays low.

Only have a 100MHz scope so this is the best I can do

Even disconnected the modem and it's not pulling RTS low.

How would I go by to change serial comms to say serial com2 and just inject the signals from the breakout pins into J16?

This is the point where Serial is configured

Tried changing that over to serial2 but since it is RTS and CTS I want to modify

#if defined(ARDUINO_PORTENTA_H7_M7) || defined(CORE_CM4)
  #define PORTENTA_H7_MODEM_ON_PIN PG_3 // PG3 is the ON pin
#elif defined(ARDUINO_PORTENTA_C33)
  #define PORTENTA_C33_CTS_PIN 61
  #define PORTENTA_C33_RTS_PIN 62
  #define PORTENTA_C33_MODEM_ON_PIN 32
#endif

I tried defining them on pin 51 & 52 for serial 2, and compiled just fine.
But I must be doing something wrong because it didn't work.

  // UART pins
  { BSP_IO_PORT_06_PIN_13,  P613 }, /*   D49    |   TX2    */
  { BSP_IO_PORT_06_PIN_14,  P614 }, /*   D50    |   RX2    */
  { BSP_IO_PORT_06_PIN_11,  P611 }, /*   D51    |   RTS2   */
  { BSP_IO_PORT_04_PIN_04,  P404 }, /*   D52    |   CTS2   */
  { BSP_IO_PORT_05_PIN_06,  P506 }, /*   D53    |   TX3    */
  { BSP_IO_PORT_03_PIN_04,  P304 }, /*   D54    |   RX3    */
  { BSP_IO_PORT_05_PIN_03,  P503 }, /*   D55    |   RTS3   */
  { BSP_IO_PORT_05_PIN_02,  P502 }, /*   D56    |   CTS3   */
  { BSP_IO_PORT_08_PIN_05,  P805 }, /*   D57    |   TX4    */
  { BSP_IO_PORT_05_PIN_13,  P513 }, /*   D58    |   RX4    */
  { BSP_IO_PORT_05_PIN_08,  P508 }, /*   D59    |   RTS4   */
  { BSP_IO_PORT_05_PIN_05,  P500 }, /*   D60    |   CTS4   */
  { BSP_IO_PORT_06_PIN_03,  P603 }, /*   D61    |   RTS0   */
  { BSP_IO_PORT_06_PIN_04,  P604 }, /*   D62    |   CTS0   */

Just FYI I use Portenta Mid Carrier + Portenta C33 + 4G Module Global and it works fine with the jumper setup as per the manual

1 Like

Hi nilsjuri
Good to know, thanks for posting.

I must have a hardware fault on the board somewhere.
When I have time I will have a good hard look at it, what I do know thus far is the RTS line stays low so something must be pulling it low via a short of some kind.

Haven't had any luck in changing the pin assignments to move over to say serial2/3 to see how the CTS and RTS line respond then.

Documentation on the pin assignments for the C33 is very limited so you end up having to guess most of the time

Ends up that the 4G module was faulty, I bought a new module went for the GLOBAL version this time and I have successfully connected to my preferred 4G network.

However, now I'm getting this time sync error.

09:11:15.910 -> +CGPADDR: 1,"100.116.135.166"
09:11:15.910 -> 
09:11:15.910 -> OK
09:11:15.910 -> AT+QNTP=1,"pool.ntp.org"
09:11:15.910 -> 
09:11:15.910 -> OK
09:11:15.956 -> 
09:11:15.956 -> +QNTP: 0,"2024/07/04,09:11:17+08"
09:11:15.956 -> AT+QLTS=2
09:11:15.956 -> 
09:11:15.956 -> OK
09:11:17.952 -> ArduinoIoTCloudTCP::handle_SyncTime could not get valid time. Retrying now.
09:11:17.952 -> AT+QNTP=1,"pool.ntp.org"
09:11:17.952 -> 
09:11:17.952 -> OK
09:11:17.997 -> 
09:11:17.997 -> +QNTP: 0,"2024/07/4,9:11:9+08"
09:11:17.997 -> AT+QLTS=2
09:11:17.997 -> 
09:11:17.997 -> OK

I'm using the base sketch created by the cloud editor, during the setup of the thing with nothing added or modified.
I have tried setting my local time to be the same as what is being pulled off NTP server but does not help.

#include "thingProperties.h"

void setup() {
  Serial.begin(9600);
  delay(1500); 

  initProperties();

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
}

void loop() {
  ArduinoCloud.update();
  // Your code here   
}

void onLEDChange()  {
  // Add your code here to act upon LED change
}

Without understanding where the NTP request originates I can't even start to understand how it works exactly. And figure out a possible solution.

Hi vdbergw,
I use long currentTime = ArduinoCloud.getLocalTime(); with my C33+MidCarrier+4G ModuleGlobal and then convert it.

Other question as you are also exploring the new 4G Global:
Does the example GPS code work for you? For me it’s not working. I posted my GPS issue already but no feedback yet: Using GPS with 4G Module Global

Thanks

Hi nilsjuri

I saw your post and am working up to it, as I also want to implement that into my project. Ran the example code: GetLocation and it also didn't work for me but haven't looked at it carefully yet. So can't comment yet.

The first hurdle is to just get connected to ArduinoCloud via 4G which is becoming a real pain....

Could you post some sample code so I can see how you did it, as I'm using auto-generated code at the moment it will be very helpful to understand how it all fits together

Yes, I also use the auto-generated code. When connecting/detecting the C33 first time with the cloud you can select WiFi,Ethernet or cellular. Selected cellular and then compiled the auto generated code and it just worked

Yeah, i also let Arduino provision the C33 (WiFi, Ethernet or Cellular) Cellular in this case and from there I get,

ArduinoIoTCloudTCP::handle_SyncTime could not get valid time. Retrying now.

Can you share some code extract so I can see how you integrate ArduinoCloud.getLocalTime() and then convert it?

How do you implement this?

I use long currentTime = ArduinoCloud.getLocalTime(); with my C33+MidCarrier+4G ModuleGlobal and then convert it.

I suspect its got something to do with this, because I noticed a 2hr difference between the NTP time and my local system time

Using ArduinoCloud.getLocalTime() with rtczero

Yes, it's also not in sync with my time zone and even the minutes are off by default. I reverse engineered and adjusted it with below offset, which works for the moment for me. Let me know if you find a better solution.

here is the straight forward code:

String getCurrentTime(){
  // Define the timezone offset in seconds (e.g., for UTC+2: 2 * 3600)
  const long offset = 5*60*60 + 12*60+20; //reverse enginenered adjustment
  // Obtain the current local time as a Unix timestamp
  long currentTime = ArduinoCloud.getLocalTime();
  // Adjust the timestamp for the timezone
  long adjustedTime = currentTime + offset;
  // Convert Unix timestamp to human-readable format
  time_t rawTime = adjustedTime;
  struct tm* timeInfo = localtime(&rawTime);
  // Format the time as a human-readable string
  char buffer[80];
  //strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", timeInfo);
  strftime(buffer, sizeof(buffer), "%H:%M:%S", timeInfo);
  return buffer;
}```

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.