Hello everyone,
I’m trying to control four motors using a ps5 controller but encounter some issues when trying to operate everything together. Below are the details and symptoms of the problem:
Setup:
- Arduino R4 WiFi: Acts as the central controller.
- Waveshare SN65HVD230 CAN Transceiver: Connected to control four ODrives for wheel motors. The connections are as follows: Power and GND to 3.3V and GND of Arduino, CANH to D13, and CANL to D10.
- ODrives: Powered by a 36V supply, used for controlling four wheels.
- USB Host Shield: Used to communicate with a PS5 controller via the USB Host library.
Individual Functionality:
- CAN Transceiver and ODrives: Function correctly using an example program from the CAN library.
- USB Host Shield and PS5 Controller: Passes all tests when using the
board_qc.ino
example from the USB Host 2.0 library. Note that the Arduino requires an external power supply for the tests to pass and code to function as expected. As such, I had connected a 9V battery to the Arduino.
Issues When Combined:
- When combining both the USB Host Shield and the CAN transceiver physically, upon running only the code for interfacing with the PS5 controller, the PS5 controller fails to be detected if the Arduino is powered through 9 volts. However, it works when powered via USB connection from a laptop.
- Running the
board_qc.ino
results in different outputs based on the power supply method.
Detailed Error Scenarios: (In all of these, the Arduino has the USB Shield on top and the CAN transceiver plugged in)
- Arduino Connected to CAN Transceiver with 9V Supply:
Circuits At Home 2011
USB Host Shield Quality Control Routine
Reading REVISION register... Die revision invalid. Value returned: 00
Unrecoverable error - test halted!!
0x55 pattern is transmitted via SPI
Press RESET to restart test
The SPI test fails with the 9V connected, even though it was the opposite when I didn’t plug in the CAN transceiver.
- Arduino Without 9V Supply (Powered via USB):
Circuits At Home 2011
USB Host Shield Quality Control Routine
Reading REVISION register... Die revision 03
SPI long test. Transfers 1MB of data. Each dot is 64K................ SPI long test passed
GPIO test. Connect GPIN0 to GPOUT7, GPIN1 to GPOUT6, and so on
Test failed. Value written: 00 Value read: FF
Press any key to continue...
This is the expected output when everything works. The GPIO test requires some additional pins connected for it to pass, so it doesn’t matter if it fails. Now, if I press any key to continue and…
- ODrives are Turned Off:
Reset number 86 Time to stabilize - 357 cycles
Reset number 87 Time to stabilize - 357 cycles
Reset number 88 Time to stabilize - 357 cycles
Reset number 89 Time to stabilize - 357 cycles
Reset number 90 Time to stabilize - 357 cycles
Reset number 91 Time to stabilize - 357 cycles
Reset number 92 Time to stabilize - 357 cycles
Reset number 93 Time to stabilize - 357 cycles
Reset number 94 Time to stabilize - 357 cycles
Reset number 95 Time to stabilize - 357 cycles
Reset number 96 Time to stabilize - 357 cycles
Reset number 97 Time to stabilize - 357 cycles
Reset number 98 Time to stabilize - 357 cycles
Reset number 99 Time to stabilize - 357 cycles
Checking USB device communication.
Reset complete. Waiting for the first SOF...
Getting device descriptor
Descriptor Length: 12
Descriptor type: 01
USB version: 0200
Device class: E0
Device Subclass: 01
Device Protocol: 01
Max.packet size: 40
Vendor ID: 0A12
Product ID: 0001
Revision ID: 8891
Mfg.string index: 00
Prod.string index: 00
Serial number index: 00
Number of conf.: 01
All tests passed. Press RESET to restart test
Everything works as expected.
- But With ODrives On:
Earlier, it displayed:
Reset number 0 Time to stabilize - 357 cycles
Reset number 1 Time to stabilize - 357 cycles
Reset number 2 Time to stabilize - 357 cycles
Reset number 3 Time to stabilize - 357 cycles
Reset number 4 Time to stabilize - 357 cycles
99 times total and then showed this error:
USB state machine reached error state
But, now, it shows this new error:
Reset number 1 Time to stabilize - 357 cycles
Reset number 2 Time to stabilize - 357 cycles
Reset number 3 Time to stabilize - 357 cycles
Reset number 4 Time to stabilize - 357 cycles
Reset number 5 Time to stabilize - 357 cycles
Reset number 6 Time to stabilize - 357 cycles
Reset number 7 Time to stabilize - 357 cycles
Reset number 8 Time to stabilize - 357 cycles
Reset number 9 Time to stabilize - 357 cycles
Reset number 10 Time to stabilize - 357 cycles
Reset number 11 Time to stabilize - 357 cycles
Reset number 12 Time to stabilize - 357 cycles
Reset number 13 Time to stabilize - 357 cycles
Reset number 14 Time to stabilize - 357 cycles
Reset number 15
Current oscillator state unexpected.
Unrecoverable error - test halted!!
0x55 pattern is transmitted via SPI
Press RESET to restart test"
The primary concern arises when all systems need to operate together, indicating possible power supply or SPI bus conflicts.
Questions for the Community:
- Has anyone faced similar issues combining these specific or similar modules?
- Could this be a power supply issue or a conflict in the SPI bus when both the shield and the transceiver are active?
- Are there any known compatibility issues with using USB Host Shield and CAN transceivers together on Arduino?
Suggestions for debugging or resolving these conflicts are highly appreciated.
Thank you for any insights or assistance you can provide!