skaarj1989/mWebSockets

Support for Portenta H7

fkromer opened this issue · 18 comments

Describe the feature

Higher end devices like the Portenta H7 do not provide pgmspace.h. This leads to a compilation error when trying to build code which uses mWebSockets on such a device (file not found error). One way to solve this issue is to provide a pgmspace.h file on the device driver side (more info about this here: arduino/ArduinoCore-mbed#343). Another way is to implement device conditional compilation, meaning adding Portenta H7 to here and here.

@skaarj1989 @facchinm I could provide a PR if you are ok with the second alternative how to extend support of the lib. If not one would have to take the first approach instead. It seems like there is no best practice about which approach to prefer over the other in the Arduino ecosystem BTW.

Environment info

n.a.

Expected behavior

Should compile on Portenta H7.

Additional context

n.a.

@fkromer I added initial support in mbed_portenta branch. It compiles, but I don't have a Portenta board, so I can't verify whether it works or not.

@skaarj1989 Thanks a lot. simple-server.ino compiles 🚀

@fkromer If you have a Portenta board, could you verify if the code is working?

@skaarj1989 Mh, the example will not work via Wifi I guess. According to the schematic of the Portenta H7 the Wifi chip on the Portenta H7 is LBEE5KL1DX. You are expecting some Wxxxx chip, right?

(...) You are expecting some Wxxxx chip, right?

Yes, that would be nice.

@skaarj1989 The Portenta H7 passes the ethernet signals via one of the two 80 pin connectors to the board in use. I've a machine control board at hand and can try this one.

(...) You are expecting some Wxxxx chip, right?

Yes, that would be nice.

The Wifi chip on the Portenta H7 is LBEE5KL1DX. Should be ok to just get rid of the outer #if NETWORK_CONTROLLER == ETHERNET_CONTROLLER_W5X00 probably.

@skaarj1989 This ethernet connection

byte mac[]{0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192, 168, 1, 2);

means random mac should be ok. The ip address is in the subnet range of my interface. Should be ok as well. I get this serial terminal output:

Initializing ... 
Server running at 0.0.0.0:3000

However I cannot establish a websocket connection.

@fkromer Server running at 0.0.0.0:3000 Obviously this is bad.
Try to run WebClient demo and see if you can get valid IP address.

Obviously this is bad.

@skaarj1989 Yepp

@skaarj1989 The WebClient demo works with DHCP. The random mac address is the same like in simple-server.ino. There is no need to watch out for a mac printed on a sticker. I'll try the websockets example with dhcp as well.

@skaarj1989 I've tried with a router and static IP. The server should be running on the static IP.

Initializing ... 
Server running at 192.168.178.211:3000

However I cannot establish a websocket connection. I get an error: socket hang up.

I've tried with static IP again. The server seems to have an IP.

Initializing ... 
Server running at 192.168.1.2:3000

However I still cannot estabish a connection due to error: socket hang up.

Is the print output Server running ... really indicating a running server or does it just return the local IP (_SERIAL.print(Ethernet.localIP());)?

@fkromer Could you verify if WebSocketClient is working?

@skaarj1989 Sure. ATM I cannot span a websocket server on my machine. Do you know some public websocket server I could connect to? I used to use http://www.websocket.org/ however the service is not available anymore.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@skaarj1989 Just want let you know that I do not need this feature anymore.

Anyways, support for Portenta board would be nice to have.