multi use ssp0

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

multi use ssp0

603 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by leluno on Sun May 04 10:33:51 MST 2014

I have a spi-lcd on SSP0/1 and a sd-card on SSP0/0. Even if  disconnect the lcd from SSP0, the card does not work. properly. Where could be the problem

void deselect (void)
{
cs_sd_high;/* CS = H */
xchg_spi(0xFF);/* Dummy clock (force DO hi-z for multiple slave SPI) */
//++kk
SSPxCR0 |= (1<<CPOL);
SSPxCR0 |= (1<<CPHA);

__set_PINSEL(1, 20, 0);// Attach SCK0 to I/O pad
__set_PINSEL(1, 23, 0);// Attach MISO0 to I/O pad
__set_PINSEL(1, 24, 0);// Attach MOSI0 to I/O pad
pinSEL(0,15,0b11);//0.15-4:ck
pinSEL(0,17,0b11);//0.17-4:miso
pinSEL(0,18,0b11);//0.18-4:mosi

//SSP0CPSR = 2;//oder 2?
//--kk

}


Labels (1)
0 Kudos
6 Replies

575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by leluno on Sun May 04 11:22:23 MST 2014
i want SSP for both because it is faster than SPI and its able to work with DMA
0 Kudos

575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by capiman on Sun May 04 11:05:20 MST 2014

Quote:
when i change lcd from ssp0 to spi, both slaves are working correct



What do you want more?
0 Kudos

575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by leluno on Sun May 04 10:48:55 MST 2014
thanks for very quick response. Its a 1768 mini -dk2-board. each slave has his own cs-line,  When i work with one slave, the other is deselected. when i change lcd from ssp0 to spi, both slaves are working correct
0 Kudos

575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by leluno on Sun May 04 10:43:03 MST 2014
void deselect (void)
{
cs_sd_high;/* CS = H */
xchg_spi(0xFF);/* Dummy clock (force DO hi-z for multiple slave SPI) */
//++kk
SSPxCR0 |= (1<<6);
SSPxCR0 |= (1<<7);
__set_PINSEL(1, 20, 0);// Attach SCK0 to I/O pad
__set_PINSEL(1, 23, 0);// Attach MISO0 to I/O pad
__set_PINSEL(1, 24, 0);// Attach MOSI0 to I/O pad
pinSEL(0,15,0b11);//0.15-4:ck
pinSEL(0,17,0b11);//0.17-4:miso
pinSEL(0,18,0b11);//0.18-4:mosi

//SSP0CPSR = 2;//oder 2?
//--kk

}

Problem with posting this code:??

SSPxCR0 |= (1<<"CPOL);
SSPxCR0 |= (1<<"CPHA);




0 Kudos

575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by capiman on Sun May 04 10:42:14 MST 2014
There seem to be missing code (stops abruptly). But also it is not enough, to see what your hardware looks like and what you are trying to do.

In general: You have two SPI slaves (LCD and SD-Card) and your controller is SPI master. Each SPI slave has its own CS (chip select) line?
Do you control the right chip select when you start working with slave x and release it when work for slave x is done (and everything was transferred)?
And then when you work with slave y select the other CS line and also release it, when work is done for slave y?
0 Kudos

575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by leluno on Sun May 04 10:38:45 MST 2014
void deselect (void)
{
cs_sd_high;/* CS = H */
xchg_spi(0xFF);/* Dummy clock (force DO hi-z for multiple slave SPI) */
//++kk
SSPxCR0 |= (1<<CPOL);
SSPxCR0 |= (1<<CPHA);
/__set_PINSEL(1, 20, 0);// Attach SCK0 to I/O pad
__set_PINSEL(1, 23, 0);// Attach MISO0 to I/O pad
__set_PINSEL(1, 24, 0);// Attach MOSI0 to I/O pad
pinSEL(0,15,0b11);//0.15-4:ck
pinSEL(0,17,0b11);//0.17-4:miso
pinSEL(0,18,0b11);//0.18-4:mosi

//SSP0CPSR = 2;//oder 2?
//--kk

}
0 Kudos