OrangeFox86 / GenesisControllerUsbPico

Sega Genesis controllers to USB adapter using the Raspberry Pi Pico microcontroller
6 stars 3 forks source link

Using a logic level converter instead voltage dividers and transistors #2

Open knifesk opened 7 months ago

knifesk commented 7 months ago

TLDR: If you're using a Logic level converter instead of a transistor, set INVERT_OUTPUTS in GenesisController.h to false;

Hi! firstly, this is more like a contribution than an Issue.

Instead of using a lot of resistors and a transistor I used an 8 channel logic level converter, more specifically the TXS0108E. Mostly because I don't have the right resistors values (nor the required amount) and I already owned the LLC.

I just wired up the same GPIOs on the Pi to the A side and the DB9 pins to the B side of the converter. Wired the 3.3V to VA and the 5v to VB and GND to GND. Also wired a second connection from the 5v to the PIN5 in the DB9.

It was supposed to work right out of the box, but it didn't, well.. most of it worked, but no quite right.. UP, DOWN, Start, A, B and C were working, but not the XYZ and Mode buttons and the LEFT and RIGHT buttons registered as pressed all the time... So I wired everything into my logic analyzer and noticed the problem after digging a couple hours through the code... The Select pin was being pulled LOW when it was supposed to be HIGH and vice-versa. Of course it would, as you're pulling the PIN7 high with a Pull-up resistor and setting the GPIO to HIGH to make the PIN7 go LOW. This was my problem, then I found the "// An NPN is used which inverts the output" comment.. so I set that to false and BOOM! it worked just fine! :D

Thanks for the docs and code, it was really simple to follow up. Well, except the part that I had to compile the entire thing in my very old raspberry pi 2 and it took forever 😅

Cheers!

Tails86 commented 7 months ago

Ah! I'm glad you figured that out. Seems like I should make that more apparent on the README/schematic and maybe move that setting to configuration.h. I should probably compile another set for release too.