hspiout setup for output only (to PGA2311)

popchops

Member
Hi all,

I'm a bit confused - hope someone can help. I want to use SPI for output only. Do I need to connect the 'hspi sdi' pin (which is C.4 on a PICAXE-40X2)? I read that: "Due to the internal operation of the microcontrollers SPI port, a hspiout command will only function when the hspiin ‘input pin’ is in the expected default state".

But - I don't know what the 'expected default state' is. Can I leave hspi sdi unconnected, or should I tie it to ground, or what?

Thanks!

Pops
 

tiscando

Senior Member
This line from the PICAXE manual sounds like nonsense to me. They probably confused it with something else in the raw PIC datasheet (hint: MSSP slave mode SCK input), so I don't see a problem here.

But it is best to tie unused inputs to ground, including the hspiin pin, so they don't float about. I recommend via resistors in case they accidentally become outputs. Just my 2 cents.
 
Last edited:

inglewoodpete

Senior Member
I want to use SPI for output only.
This is not an answer to what you are asking but the PICAXE can only handle SPI output OR SPI input as a master controller, by using the hspout and hspiin commands.

I spent many hours trying to get a 28X2 to work in "duplex" mode (send and receive in one command), without success. Also, since both hspout and hspiin toggle the clock pin, the PICAXE cannot be used as a SPI slave. I tried peeksfr and pokesfr to modify the PICAXE's SPI behaviour but the firmware always had the upper hand. I ended up using a PIC and writing the code in Microchip's C for both the master and slave.
 
Top