Coder Social home page Coder Social logo

Hardware SPI on Leonardo about psxnewlib HOT 16 CLOSED

sukkopera avatar sukkopera commented on May 29, 2024
Hardware SPI on Leonardo

from psxnewlib.

Comments (16)

sonik-br avatar sonik-br commented on May 29, 2024 1

Great news!
Got another level shifter and now it works!
3.3v on power and data pins to the guncon and using hardware SPI.
Now my other guncon (a thirdy party one) seems to work. It was not even detecting previously when using bitbang.
I will wait for the shield to arrive to test it more.

from psxnewlib.

SukkoPera avatar SukkoPera commented on May 29, 2024

It works great on the Leonardo, make sure to use the right pins and 1k pullups.

Also make sure to use the right pin for ATT. I think it's 10 by default, switch pin or change it in the sketch.

from psxnewlib.

sonik-br avatar sonik-br commented on May 29, 2024

1k pullups in which pins? I'm not good with electronics XD

from psxnewlib.

SukkoPera avatar SukkoPera commented on May 29, 2024

On DAT/MISO at least.

from psxnewlib.

SukkoPera avatar SukkoPera commented on May 29, 2024

image

This is the correct way to do the connections by the way.

from psxnewlib.

sonik-br avatar sonik-br commented on May 29, 2024

No luck :(
Even with the 1k pullups on the MISO pin.

I'm powering the psx controller with 3.3v from the arduino. But all other pins are 5v.
This might be the problem?

from psxnewlib.

SukkoPera avatar SukkoPera commented on May 29, 2024

Well, if all the other pins are 5V you're not driving the controller properly. I know everybody out there does that but it doesn't make me happy. Try powering the controller at 5V too, but do so at your risk. The 3v3 regulator might not be able to provide enough current.

I'd send you one of my PsxShields to thank you for the collaboration but I see you live in Brazil, which I had a lot of problems shipping to :(.

from psxnewlib.

sonik-br avatar sonik-br commented on May 29, 2024

Thanks but yeah, postal services here are not reliable.

Something like this would work for the data pins?
https://www.amazon.com/HiLetgo-Channels-Converter-Bi-Directional-3-3V-5V/dp/B07F7W91LC/

I can get some here at the local electronics store for a good price. And it seems foolproof to me :)
The schematic:
https://s3-sa-east-1.amazonaws.com/robocore-lojavirtual/522/Level.Shifter_v1.1.pdf

from psxnewlib.

SukkoPera avatar SukkoPera commented on May 29, 2024

Well, it's the same shifting technique I've used on my shield:
image

As you can see, I have changed the pull-ups to 1k, after measuring a real PSX console. This gave me some more compatibility, but most controllers were also working with 10k.

Besides that, you'd also need a beefier 3.3V regulator. I'm not sure how much current the PSX controller needs, but the 3v3 regulator on most Arduinos is really really weak.

Can you solder SMD stuff?

from psxnewlib.

sonik-br avatar sonik-br commented on May 29, 2024

No, I can't do SMD stuff.
Controller (guncon) works fine using "bitbang" with 3.3v power and 5v on data pins.
Serial must be more sensitive to voltage level?

EDIT:
This could be used for the regulator?
AMS1117
image

from psxnewlib.

SukkoPera avatar SukkoPera commented on May 29, 2024

Not really, SPI should be more reliable, actually. What do you get if you enable debugging?

I will try sending you a shield, please send me your address by email. I will solder the SMD stuff for you but I have run out of the long pin headers, will you be able to get those yourself and solder them?

Yes, that regulator will be fine.

from psxnewlib.

sonik-br avatar sonik-br commented on May 29, 2024

Thanks :)

I tested with the DumpButtonsHwSpi example and it wont send anything to the serial debug.
With DUMP_COMMS on PsxNewLib.h it was sending some info to the serial.
I will have to run it again and copy the results here.

I will also do a quick test with the correct regulator and level shift.

from psxnewlib.

SukkoPera avatar SukkoPera commented on May 29, 2024

That is very weird, you should get some output even if you don't connect your controller... I think. It's been a while since I worked on this lib.

Let me know what shows up with DUMP_COMMS.

from psxnewlib.

sonik-br avatar sonik-br commented on May 29, 2024

I was testing it right now... properly wired with 3.3v level shift and regulator.
Log starts with no controller connected.
It shows various connect/disconnect. But it was connected all the time.

Serial LOG.txt

from psxnewlib.

sonik-br avatar sonik-br commented on May 29, 2024

Done a quick test with DumpButtonsBitBang but this time using the SPI pins. Won't work.
From my understanding the dedicated pins should work as common digital I/O pins.
Starting to think I have a bad board.

from psxnewlib.

SukkoPera avatar SukkoPera commented on May 29, 2024

Yep, it should work if you use the following pin numbers:

#define PIN_SPI_MOSI  (16)
#define PIN_SPI_MISO  (14)
#define PIN_SPI_SCK   (15)

MOSI goes to CMD and MISO to DAT.

from psxnewlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.