SPI With Reset Pin

All about Sub-20 Multi Interface USB Adapter USB to I2C, SPI, GPIO, RS232, RS485, Ir, LCD

Moderator: serg

Post Reply
Hugoneus
Posts: 11
Joined: Tue May 11, 2010 9:01 pm

SPI With Reset Pin

Post by Hugoneus »

Hi,

I have gotten the MATLAB code to work for SPI communication using MISO, MOSI, SCK & SS0.

But the circuit that I use also needs a Rest pin. I wanted to use SS1 for that purpose. Is that possible? Can you show me a few lines of code to do that?

serg
Posts: 143
Joined: Mon Aug 31, 2009 9:17 pm

Re: SPI With Reset Pin

Post by serg »

Hi Hugoneus,

Even though using the SS1 as a reset signal is probbaly possible, why you don't consider using a GPIO pin instead?

Regards

Hugoneus
Posts: 11
Joined: Tue May 11, 2010 9:01 pm

Re: SPI With Reset Pin

Post by Hugoneus »

Yes, I know that is possible.

But for our product, we are running a single ribbon cable from the SUB-20 SPI port to our board. We don't want to splice that cable to get to one of the GPIO pins.

The only connection we wish to use is the 10-pin SPI connector.

serg
Posts: 143
Joined: Mon Aug 31, 2009 9:17 pm

Re: SPI With Reset Pin

Post by serg »

Ok, in this case the following should work for you (I didn't try)

dummy = NET.createArray('System.Byte', nclks )
sub20.SPI_Write( dummy, 1, 13 )

,where
nclks - length of the reset pulse on the SS1 pin in clocks
use sub20.SpiSS_LO for negative reset pulse as a third parameter(instead of 13)
I used the const 13 because the "sub20.SpiSS_HI" definition is missing in the current release of the SUB-20 .NET component,
please refer to the C header file for all numeric constants.

so from the libsub.h:

#define SS_HI 0x0D /* ____/-- - -\__ _ */




Regards

Post Reply