rogerlz / rampon_anchor

MIT License
12 stars 4 forks source link

Distinguishing two KUSBA devices running Rampon #8

Open ginkel opened 6 months ago

ginkel commented 6 months ago

Hi there,

I built two KUSBA USB accelerometers to measure the X axis and bed resonances of my Anycubic i3 Mega S printer without having to move the probe between axes. When I attach both devices to my Raspberry Pi, however, they both seem to get the same id, so they conflict and only one entry in /dev/serial/by-id/ "wins":

# ll /dev/serial/by-id/
total 0
lrwxrwxrwx 1 root root 13 Feb 25 20:53 usb-Anchor_Rampon-if00 -> ../../ttyACM1
lrwxrwxrwx 1 root root 13 Feb 25 16:01 usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_f2b72a345c64e911ade3dea733226a36-if00-port0 -> ../../ttyUSB0

The other unit is /dev/ttyACM0.

Any ideas?

Edit: The W25Q16JVSNIQ flash chip installed on the KUSBA PCB should expose a unique ID. Docs how to read it from the Pico SDK, are available at: https://www.raspberrypi.com/documentation/pico-sdk/high_level.html#pico_unique_id

That's probably different from Rust, though...

Edit 2: As a workaround, I compiled a custom version for the device attached to the print bed that uses a custom (but hard-coded) serial number, cf. https://github.com/rogerlz/rampon_anchor/commit/405031eec7d53137ae96e2a6e02a08d884522d59.

rogerlz commented 4 months ago

yeah the rp2040-hal doesn't have an easy way to read the unique id.. the rp2040-flash does have it, but has the rp2040-hal pinned to 0.9 :( let me think what'd be easier