raphnet / dreamcast_usb

Dreamcast controller to USB adapter firmware
GNU General Public License v2.0
30 stars 5 forks source link

dc to usb #2

Open kn1jon opened 2 years ago

kn1jon commented 2 years ago

hello, I decided to replicate your device. Does the device only work with original sega controllers? in my case, a copy of the original and I have a delay of about 20 seconds. I use the board arduino pro mini atmega168pa(smd variant). please help with this question, thank you in advance

raphnet commented 2 years ago

This project is only tested with the devices listed on the webpage: https://www.raphnet.net/electronique/dreamcast_usb/index_en.php It's not impossible that there would various reliability issues with other 3rd party controllers. Do you have an oscilloscope available for checking the communication between the CPU and the Controller?

What do you mean by delay of 20 seconds? Delay before the device enumerates on the USB bus? Delay until a button press registers? If the latter, it could mean that most controller packets get lost or rejected due to communication errors, but the occasional packet that makes it through (once every several seconds for instance) could cause an apparent delay.

You could try defining NOLRC in maplebus.c and recompiling, to see if it helps. This will disable checks for invalid packets and may result in random button presses, however it should make the delay disappear and confirm that the issue is that packets are not received correctly.

By the way, I see the 5V version of the arduino pro mini runs at 16 MHz, and the 3.3V version runs at 8 MHz. Did you add level translators to communicate with the controller at 3.3v and not 5v? Or did you modify your Arduino to run the Atmeag168 at 16Mhz and 3.3v (i.e. overclock) like I did?

kn1jon commented 2 years ago

no oscilloscope(

kn1jon commented 2 years ago

no, i have a 5v version at 16mhz

kn1jon commented 2 years ago

I press the gamepad button, the first press is displayed correctly. then there is a freeze of about 10-20 seconds

kn1jon commented 2 years ago

can this be due to the fact that I did not put 68 ohm resistors on the usb data line?

kn1jon commented 2 years ago

it is still difficult for me with programming, I am well versed in electronics

kn1jon commented 2 years ago

I think not compatible, I will order ATMEGA8-16AU

raphnet commented 2 years ago

no, i have a 5v version at 16mhz

Then this means you are sending 5v signals into the controller data lines. Those are supposed to work at 3.3 volt. Maybe they are 5v tolerant, but I would not count on this. It could end up damaging your controller.

Also, this means that you are sending 5v signals into the USB d+ and d- pins. This is a violation of the USB specification. While I seem to recall that USB is designed to survive this, communication may not be reliable. In my other designs where the CPU runs at 5 volt, I used zener diodes to clamp the voltage and 68 ohm resistors to limit current, as recommended in the V-USB manual. For instance, here is another design where this is done: https://www.raphnet.net/electronique/multiuse_pcb2/multiuse_pcb2_schematic1.png

I cannot explain the 10-20 seconds freeze, but I think the first step would be to correct the problems above and take it from there. I would also strongly recommend testing with an original controller, to rule out any 3rd party controller issues.

kn1jon commented 2 years ago

I understand you, thanks for your time and help