PROBLEM - Starting of sketch

Hi everyone,
I uploaded my skecth on arduino portenta machine control. When I supply my device with 24 Vdc without usb cable, the it doesn't run the sketch.

is your sketch waiting for the USB connection to be open?

also read https://support.arduino.cc/hc/en-us/articles/4410804632594-Power-the-Portenta-Machine-Control

I use the usb cable for upload the sketch, bui i need to used the usb cable also for running? I think that the 24 Vdc is enough or not?

How are you supplying 24 volts to a device who's input V's are 5V?

Schematic?

Image of project?

The arduino machine control is supplied by 24Vdc, you can read the datasheet (https://support.arduino.cc/hc/en-us/articles/4410804632594-Power-the-Portenta-Machine-Control?_gl=1*127509h*_ga*MTI3NjI2MzE0Ni4xNjYxNzYzNTYy*_ga_NEXN8H46L5*MTY2NDc4MjA5My4zOS4xLjE2NjQ3ODYwNDkuMC4wLjA.)

I confirm that the usb cable is necessary for the execution of the sketch.
Thank you for your support.

it should not. it would be a major blocker for industrial use if it were the case...

again, can you share what you do in the setup()?

it's not your typical arduino... :slight_smile:

see the link above https://support.arduino.cc/hc/en-us/articles/4410804632594-Power-the-Portenta-Machine-Control

1 Like
void setup() 

  Serial.begin(9600);                                         // Inizializate the serial monitor 
  while (!Serial)                                             // wait the serial port is ready
  Wire.begin();                                               
  if (!digital_inputs.init())                                 
  {
  Serial.println("GPIO expander initializzation fail!");      
  }
  if(!digital_programmables.init())                           
  {
  Serial.println("GPIO expander initializzation fail!");     
  digital_outputs.setLatch();
  digital_outputs.setAll(0);  
}

what happens if you remove this

Well, you can either have Serial Monitor debugging, or you can have independent operation.
If you want to leave in the serial monitor debugging, but run independently, then J-M-L is correct, remove the dependency, because as it is, it's waiting for Serial Monitor to be present.

He could have some timeout for that wait in the code

uint32_t t0 = millis ();
while (!Serial) 
  if (milis() - t0 >= 2000ul) break;
2 Likes

Thank you!
Now the device is working!

great :wink:
have fun

1 Like