20X2 hspi - sdi State

Solar Mike

New Member
I want to send data to some shift registers using the hspi - sdo pin C.1 on a 20X2 chip, I dont care about the sdi input B.5.

Reading the manual is a rather vague about the subject, saying the sdi port has to be in the correct state in order to send data out, without actually saying what state is needed; the only example is for an EEPROM read\write.

Can anyone tell me what I need to do with the sdi input, do I just ground it or pull it high, or can I ignore it and use it for other purposes.

Cheers
Mike
 

inglewoodpete

Senior Member
It's been a while (5 years) since I used the PICAXE's hSPI. I think that Rev-Ed are saying that, if the SPI idle state is configured as idle-low, then the SPI-In pin should be low before starting a transfer (and vice-versa).

Having just said that, I don't recall it having any effect in my project. You might have to test the theory yourself and report back.

As an aside, you can't use a PICAXE SPI in full duplex mode (Shift In and Shift Out in the same transfer) - even if you use PeekSFR and PokeSFR commands. I spent hours trying to make it work before giving up and using a raw PIC and MPLAB X.
 

Solar Mike

New Member
Thanks, I'm in the middle of designing another pcb with the 20X2, too complex for breadboarding, so I will terminate in a 3-pin link, allowing high or low on the sdi pin.

Cheers
Mike
 

inglewoodpete

Senior Member
Thanks, I'm in the middle of designing another pcb with the 20X2, too complex for breadboarding, so I will terminate in a 3-pin link, allowing high or low on the sdi pin.

Cheers
Mike
Breadboarding is still a good idea - just to test the SPI functionality.

You just need the power and download components plus a couple of LEDs with resistors to test the functionality. A few lines of code to initialise the hSPI peripheral and then enter a loop the outputs a few bytes before a longing pause (Eg 2-seconds). If you set the SPI clock speed very low and get the LED polarity correct, you should see the Clock and DO pins flash if they are toggling.
 
Top