hspiout setup for output only (to PGA2311)

popchops

Well-known 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.
 

fernando_g

Senior Member
Popchops;
Did you ever solve your issue?

I am having the exact same situation, where I require to shift serial data out to drive a Texas Insts DAC7714.
For this device, the clock must idle high.
However for the lone 28X2 I got, while loading the program the firmware vB.3 gives me an error message indicating that: for Shiftout MSBFirst_H, this mode is not supported.
It supports Shiftout MSBFirst_L, but the DAC doesn't work as expected in this mode.

So the next thing to attempt is precisely the hserout command, but I also stumbled upon the same "expected default state" paragraph.
 
Top