keyplus icon indicating copy to clipboard operation
keyplus copied to clipboard

Improve USB port detection

Open ahtn opened this issue 7 years ago • 0 comments

When a device is powerd on and detects USB voltage on its VBUS check pin, it needs to decide whether it has connection to a USB host, or if it only has I2C connections to other devices. This is important because only the device with the host connection should enable its NRF24 module. If multiple nRF24 modules are active simultaneously, they will interfer with each others auto-ack functionality.

When the device only has one USB port, this should not be too difficult, as it can leave it's USB data lines active at all times and only run the initialization code after a IRQ, but continue operating as normal.

However, if the DUAL_USB feature is used, then that implementation cannot be used, since the USB data lines need to be switched to I2C. So in this case, the device should active an I2C connection on each of its ports in turn and ping for other devices. In this way, it can deduce that a port is I2C. Whenever a device, finds out that it has a USB port, it should ping the other devices, so that they know that all their other ports can be switched to I2C.

ahtn avatar Jan 12 '18 11:01 ahtn