meatpiHQ / meatpi_ollie_v2

32 stars 2 forks source link

Device enumeration on macOS #2

Open rgov opened 8 months ago

rgov commented 8 months ago

On macOS, the system creates the following, as well as /dev/tty.* with the same suffixes. I've added what I think these map to:

USB Quad_Serial
/dev/cu.usbmodem01234567891  --  MEATPI-UARTA
/dev/cu.usbmodem01234567893  --  MEATPI-UARTB
/dev/cu.usbmodem01234567895  --  MEATPI-RS232
/dev/cu.usbmodem01234567897  --  MEATPI-RS485

MeatPi Dual CAN
/dev/cu.usbmodem11201  --  MEATPI-CAN0

I played around with the IORegistry and I don't see a way to map the USB device tree entries to these files under /dev. The 0123456789 comes from the serial number presented by the USB device.

stevecheckoway commented 7 months ago

@rgov Were you able to send any data through those?

I didn't think to check the /dev/cu.* files, but I tried all of /dev/tty.usbmodem0123456789[1357] and /dev/tty.usbmodem21201 (which I note has a different numerical suffix than the one you posted) with no luck. I was able to open the devices (using screen /dev/tty.usbmodem01234567891 9600 as well as with PySerial) but couldn't see any output on the RS232 Tx pin on my oscilloscope nor did I have any luck connecting the Tx and Rx pins together (which is how I normally test serial).

rgov commented 7 months ago

I am not sure I ever got it to work. I was trying to flash a ESP32 microcontroller and I think I just went back to using my Bus Pirate.

meatpiHQ commented 7 months ago

sorry guys, I don't have much experience with macOS.

@rgov @stevecheckoway did you install the drivers?

joegrand commented 6 months ago

FWIW, on macOS Sonoma 14.3.1 (MacBook Pro M2 Max), I had the same problem as @rgov and @stevecheckoway, only being able to see the ports but not communicate properly to them:

/dev/tty.usbmodem01234567891
/dev/tty.usbmodem01234567893
/dev/tty.usbmodem01234567895
/dev/tty.usbmodem01234567897
/dev/tty.usbmodem1212201

System report shows:

Screenshot 2024-03-14 at 9 20 21 PM

After installing the drivers linked by @meatpiHQ above (I used the .dmg), I now see another set of ports (along with the ones above):

/dev/tty.wchusbserial01234567891
/dev/tty.wchusbserial01234567893
/dev/tty.wchusbserial01234567895
/dev/tty.wchusbserial01234567897

/dev/tty.wchusbserial01234567891 definitely maps to MEATPI-UARTA, but haven't tested the others.

I incorrectly assumed drivers weren't needed since macOS seemed to detect the device, but all is working now! This should probably be added to the README.md in the Drivers section.

meatpiHQ commented 6 months ago

@joegrand Thanks for confirming that the macOS drivers work.