Thursday, August 28, 2008

PS2 Controller no worky

Well, last session I got the code into the MCU and got the receiver attached to the MCU. However, I could not get the receiver to respond to my SPI requests at all. A bunch of the session time was spent diagnosing what I was transmitting however. I had the bit order wrong. I was going at the maximum 500Khz which probably wasn't so good on a bread-board with all it's capacitance. I had a code path which didn't manage the slave select properly.

I was able to see all this on Tom's nifty LogicPort usb analyzer. Oh, yea, it took a while to figure out how that software worked too.

However, I worked through all those issues and got what I was transmitting to look pretty good before the session was over. However, still no replies.

I have two things I want to investigate next time:
  1. I am mixing 3.3V and 5V tech here. Now, the logic analyzer was set to 1.5V logic so I would have seen any response from the PS2 controller on the LogicPort even if the MCU didn't see it. However, the notes I'm reading say only some of the PS2 controllers are good at 5V whereas others won't work at all. I need to suck it up and slap down the transistors I need to do the voltage conversion properly. I should also look into using the ATmega48/88/168 which will run at 3.3V no problem. However, the code is setup for the ATmega32 core at the moment and it will take less time to plop down the transistors than switch the code to the newer cores.
  2. One odd bit I noticed about the slave select: it selects long before it sends any data. In fact about half the time the the device is selected, no data is sent at all. Most of that time is before any data is sent. I'm not sure what my code is doing to cause such a delay but I should look into the issue against the possiblity that being selected so long with out data angers the reciever.

No comments: