felis / USB_Host_Shield_2.0

Revision 2.0 of USB Host Library for Arduino.
https://chome.nerpa.tech
1.78k stars 780 forks source link

PS3 USB Host shield + SD-card shield + ESP-now #441

Open LegendBuilders opened 5 years ago

LegendBuilders commented 5 years ago

Hardware: Arduino: Board: ESP32 Dev Module (https://goo.gl/os9V7Q) Core Installation/update date: ?11/jul/2017? IDE name: Arduino IDE Flash Frequency: 80Mhz Upload Speed: 921600

SD-card reader module: https://goo.gl/bDVYtN Mini USB Host Shield: https://goo.gl/7x5KF1 Bluetooth USB dongle: https://goo.gl/Ks8WTA

Description: For my end-project for school I'm designing a baitboat for fishing. This need to use a SD-card reader module (to save the location of the boat) and a USB Host Shield (for receiving Bluetooth data from a PS3 console). The "brain" of the project are 2 ESP32's.

A few weeks ago I programmed the USB Host Shield, everything worked out great and no problems. A weekend ago I programmed the SD-card reader, worked also great and no problems.

The SD-card reader had some problems using a on-board chip that prevented that other devices uses the same SPI-bus, but by using Software-SPI, they both got working properly.

When I wanted to also add the ESP-now functionality, it was starting to get a little buggy. Everything is succesfully initialized (if using some delays between them) but the LED of the Bluetooth USB dongle won't light up. But the strange thing is: when I plug the whole system into a powerbank (output 5V/2.4A max) the LED starts to blink. I can't imagine that this system can pull around 1A (max output for PC usb-port).

Sketch: https://pastebin.com/0G8iJiUz

Serial Monitor: https://pastebin.com/Y59YmTsA

If there's more information needed, let me know it please!

Can someone help me?

xxxajk commented 5 years ago

A few hints that may help from my past experience in dealing with many canned SPI libraries.

1: Many third-party SPI libraries will totally violate your ability to control the CS line manually. Use a pin that isn't controlled by the library. 2: Make sure that you use very short wires. Long wires at high speeds can cause problems such as cross-talk and EMI/RFI interference.

LegendBuilders commented 5 years ago

A few hints that may help from my past experience in dealing with many canned SPI libraries.

1: Many third-party SPI libraries will totally violate your ability to control the CS line manually. Use a pin that isn't controlled by the library. 2: Make sure that you use very short wires. Long wires at high speeds can cause problems such as cross-talk and EMI/RFI interference.

Thanks for your answer! 1: The SPI-library I'm using is the one in SdFat. It's possible to use a Software-SPI so you can use any pin you want for this (https://goo.gl/axaPJD). 2: The wires I'm using are very short (around 5-10cm). But the strange thing is that everything works fine without the ESP-now functionality.

Anyone more ideas?