Hello! I am wondering if someone else can replicate this bug. I seem to be getting a conflict when using USB host to read a HID device (testing with FS) and ethernet. The ethernet seems to still work, but the USB never reads any data.
#include "USBHost.h"
#include <PortentaEthernet.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
USBHost usb;
// The IP address will be dependent on your local network:
IPAddress ip(192, 168, 0, 177);
unsigned int localPort = 8888; // local port to listen on
// buffers for receiving and sending data
char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; // buffer to hold incoming packet,
char ReplyBuffer[] = "acknowledged"; // a string to send back
// An EthernetUDP instance to let us send and receive packets over UDP
EthernetUDP Udp;
static int process_hid_recv(tusbh_ep_info_t* ep, const uint8_t* data, uint32_t len) {
//Serial.println("test");
for (int i = 0; i < len; i++) {
if (data[i] != 0) {
Serial.println(data[i]);
}
}
}
static const tusbh_hid_class_t cls_hid = {
.backend = &tusbh_hid_backend,
.on_recv_data = process_hid_recv,
//.on_send_done = process_hid_sent,
};
static const tusbh_class_reg_t class_table[] = {
(tusbh_class_reg_t)&cls_hid,
0,
};
void setup()
{
Serial.begin(115200);
Serial.println("Booted");
//usb.Init(USB_CORE_ID_HS, class_table);
usb.supplyPowerOnVBUS(true);
usb.Init(USB_CORE_ID_FS, class_table);
/* //Works if the following line is uncommented
// start the Ethernet
Ethernet.begin(ip);
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// Check for Ethernet hardware present
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :(");
while (true) {
delay(1); // do nothing, no point running without Ethernet hardware
}
}
if (Ethernet.linkStatus() == LinkOFF) {
Serial.println("Ethernet cable is not connected.");
}
// start UDP
Udp.begin(localPort);
*/
}
void loop() {
usb.Task();
}