I need help to use GPIO pin as a Chip Select pin in MC60(SPI protocol).
Hi dineshkumar.15mc
If you want use soft SPI in MC60,you could refer to the following method and any GPIO pin could be used.
*======================
-
Example:
*====================== -
you could use this api like this for H/W SPI:
-
Ql_SPI_Init( 1, //spi channel select.
PINNAME_PCM_IN, //spi CLK pin, can not change to another pin.
PINNAME_PCM_SYNC, //spi MISO pin, can not change to another pin.
PINNAME_PCM_OUT, //spi MOSI pin, can not change to another pin.
PINNAME_PCM_CLK, //spi CS pin, user can change this pin to annother pin.
//if user chose another pin, user should init the pin and must maintain the level by self.
1 //for H/W SPI.
); -
you could use this api like this for S/W SPI:
-
Ql_SPI_Init( 1, //spi channel select.
PINNAME_PCM_IN, //spi CLK pin, user could those another pin.
PINNAME_PCM_SYNC, //spi MISO pin, user could those another pin.
PINNAME_PCM_OUT, //spi MOSI pin, user could those another pin.
PINNAME_PCM_CLK, //Iglore it. User could chose another pin and init it, maintain the level by self.
0 //for S/W SPI.
);
I used same like what You said…but i didn’t get value…
Did you use an oscilloscope to see that there is no output at all?
Hi ,
I think you are asking how can you select different pin as CS than PCM_CLK which is provided in example_SPI .
you can use any other pin also while initializing the SPI, only thing which you need to take care is about handling the level at appropriate time .
You can initialize multiple channels with difference Chip select pins .
//chnnlNo, //pinClk, //pinMiso, //pinMosi, //pinCs, //spiType
ret = Ql_SPI_Init(USR_SPI_CHANNAL,PINNAME_PCM_IN,PINNAME_PCM_SYNC,PINNAME_PCM_OUT,PINNAME_PCM_CLK,spi_usr_type)
Thank you
Ratan