Using the USB-A port on the Arduino Portenta H7 Machine Control

Hello

I'm using an Arduino Portenta Machine Control and I'm trying to get the board to interface with Matlab running on my PC. I am sending all the data serially through the micro USB port that is used to program the Arduino. There is also an additional USB-A port on the Arduino that I would like to use to send data serially. I tried plugging a USB-A cable from the computer and there was no detection. There is a detection when I plug in the micro-USB port. Basically, I would like to see an example of how to use the USB-A port on the Arduino Portenta H7 Machine Control.

Better start by citing the Web links for the full datasheet on this device. :thinking:

USB-A indicates that that port is a USB host. You can not connect it to a PC which also acts like a host. That port is meant to be used to connect e.g. a keyboard or another Arduino or a printer or ...

How? Did you hack your own cable?

Datasheet :wink:
https://content.arduino.cc/assets/AKX00032-datasheets.pdf?_gl=1*1wao8qg*_ga*MTEwNDA2ODE3LjE2MTQ3NjE2NjQ.*_ga_SELSHHP7SG*MTYzNTg3MTQyMS42MC4xLjE2MzU4NzE2MzMuMA..

Thank you for linking the data sheet.

So in the data sheet it mentions that the USB-A port can be used in both host and device configurations. I found code on the official Arduino GitHub page for the Portenta Machine Control (Arduino_MachineControl/USB_host.ino at master · arduino-libraries/Arduino_MachineControl · GitHub) to turn it into a USB host. How would you configure the port to act as a device, or is it by default already configured as a device?

I would also like to know how to set this up as device instead of host.

I have the same question and I see this thread is open for months with such a simple question and no answer... too bad the developper fail to document.. or even reply to such a question... I tried to open Serial 2 and Serial 3 but it doesn't seem to work...

I think this is were things happen..... any help???

/*
Serial.h - wrapper over mbed RawSerial
Part of Arduino - http://www.arduino.cc/

Copyright (c) 2018-2019 Arduino SA

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/

#include "api/RingBuffer.h"
#include "Arduino.h"
#include "api/HardwareSerial.h"
#include "PinNames.h"
#include <platform/FileHandle.h>

#ifdef __cplusplus

#ifndef ARDUINO_UART_IMPLEMENTATION
#define ARDUINO_UART_IMPLEMENTATION

typedef struct _mbed_serial mbed_serial;
typedef struct _mbed_usb_serial mbed_usb_serial;

namespace arduino {

class UART : public HardwareSerial {
public:
UART(int tx, int rx, int rts = -1, int cts = -1);
UART(PinName tx, PinName rx, PinName rts = NC, PinName cts = NC) : _tx(tx), _rx(rx), _rts(rts), _cts(cts) {}
UART() {
is_usb = true;
}
void begin(unsigned long);
void begin(unsigned long baudrate, uint16_t config);
void end();
int available(void);
int peek(void);
int read(void);
void flush(void);
size_t write(uint8_t c);
size_t write(const uint8_t*, size_t);
using Print::write; // pull in write(str) and write(buf, size) from Print
operator bool();
operator mbed::FileHandle*(); // exposes the internal mbed object

#if defined(SERIAL_CDC)
uint32_t baud();
uint8_t stopbits();
uint8_t paritytype();
uint8_t numbits();
bool dtr();
bool rts();
#endif

private:
	void on_rx();
	void block_tx(int);
	bool _block;
	// See https://github.com/ARMmbed/mbed-os/blob/f5b5989fc81c36233dbefffa1d023d1942468d42/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/serial_api.c#L76
	const size_t WRITE_BUFF_SZ = 32;
	mbed_serial* _serial = NULL;
	mbed_usb_serial* _usb_serial = NULL;
	PinName _tx, _rx, _rts, _cts;
	RingBufferN<256> rx_buffer;
	uint8_t intermediate_buf[4];
	bool is_usb = false;

};
}

extern arduino::UART UART1;
extern arduino::UART UART2;
extern arduino::UART UART3;
extern arduino::UART UART4;
extern arduino::UART UART_USB;

#endif
#endif

May I suggest that you contact Arduino via https://www.arduino.cc/en/contact-us/ if you haven't done so yet. I have no experience with the Portenta family.

@theshade, fyi, developers do usually not hang around on the forum.

Thanks I just did...

Did you get any help from the support?
i would like to send data from PMC-USB to PC-USB via Serial.print() like on the UNO. But it won´t work.
Did you get the same issue?

i´ve asked the support for help, but they don´t know too.

I am still waiting for some support too... hopefully soon.....

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