Sending 3 bytes over SPI without /SS getting high

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sending 3 bytes over SPI without /SS getting high

3,801 Views
nikfo
Contributor I
Hello!
As newbie to programming and S12 I have what might be a silly question.

I am going to use S12 to send 3 bytes of data to 3 daisy chained shift regs. What I want is this: when I initiate the transfer I would like /SS to go low, thereby selecting my slave device. Then I send 3 bytes and after that transfer is done, I would like /SS pin to go high and latch data from shiftregs to their output.

The function I am looking for is exactly what I understand is possible to do if the transmission were only one byte.

One solution to this would be to disable the /SS pin from SPI and use it as GPIO. In that way I can have the function I want but it needs to be controlled by SW.

Is it possible to send 3 bytes over SPI with /SS low during the whole transmission?

Greatful for all responses!
//Niklas
Labels (1)
0 Kudos
4 Replies

658 Views
nikfo
Contributor I
Hi bigmac!
That is exactly what I would like to do. BUT I rather not use a GPIO for strobing the registers. I would like to use the "built-in" /SS function for this. Is it possible?
The other method with GPIO is solved, this would just be an improvment.

best regards
Niklas
0 Kudos

658 Views
bigmac
Specialist III
Hello Niklas,
 


nikfo wrote:
BUT I rather not use a GPIO for strobing the registers. I would like to use the "built-in" /SS function for this. Is it possible?


No, I don't believe it is possible to use the built-in /SS hardware function.  However, you should be able to allocate the /SS pin as GPIO, and generate the strobe pulse to this pin within your firmware.

Regards,
Mac


0 Kudos

658 Views
nikfo
Contributor I
Hi bigmac!
So be it then!
As you said, I use the /SS pin as GPIO to control the strobing. I really hope it works that way since my custom card is designed with /SS as latch clock =).

//Niklas
0 Kudos

658 Views
bigmac
Specialist III

Hello Niklas,

I presume you would be using parallel output shift registers such as 74HC595.  So MOSI would connect to pin 14 of the first device, and pin 9 would connect to pin 14 of the next device, etc.  The SPI clock signal would connect to pin 11 of all three devices.  You would then choose a GPIO output to strobe pin 12 of all three devices.  MISO would not be used unless parallel input shift registers were also present.

In operation, you would simply send three bytes in succession, and then pulse the strobe signal to update the outputs.  For compatibility with these shift registers, the SPI master should be configured for either of the two following combinations:

1.  CPHA=0 and CPOL=0, or
2.  CPHA=1 and CPOL=1

Regards,
Mac

 

0 Kudos