cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with BSPI slave pin

noz4r2
Associate II
Posted on December 03, 2007 at 13:41

Trouble with BSPI slave pin

2 REPLIES 2
noz4r2
Associate II
Posted on November 08, 2007 at 06:54

Hello all

im having a little bit of trouble with the bspi the clock works perfect and so does sending data but the slave select pin doesnt turn zero to select the device(only one device attached) ive tryed setting it manually but to no avail. please see code below

Code:

void InitaliseQTouch(void)

{

// P0.0 ''MISO''

// P0.1 ''MOSI''

// P0.2 ''SCLK''

// P0.3 ''SS''

//P2.9 ''DRDY''

//P2.10 ''CHANGE''

GPIO_Config (GPIO0,(1<<1)|(1<<2)|(1<<3), GPIO_AF_PP); // set up port pins.

GPIO_Config(GPIO2,(1<<9)|(1<<10),GPIO_IN_TRI_CMOS);//data ready and change pins

GPIO_Config(GPIO0,0,GPIO_IN_TRI_CMOS);//MISO

//GPIO_BitWrite(GPIO0,3,0x00);

BSPI_BSPI0Conf ( ENABLE );

BSPI_Init ( BSPI0 );

BSPI_ClockDividerConfig( BSPI0 ,230 );// this gives a 20 micro wave.10 up 10 down

BSPI_Enable ( BSPI0 , ENABLE);

BSPI_MasterEnable ( BSPI0 , ENABLE);

BSPI_ClkActiveHigh ( BSPI0 , DISABLE);//this should make it idle high

BSPI_ClkFEdge ( BSPI0 ,DISABLE); //dont get data on first clock edge

BSPI_8bLEn ( BSPI0 , ENABLE); //allow 8 bit words

// BSPI_FifoDisable ( BSPI0 );

BSPI_RcFifoDepth ( BSPI0 , 3 ); // 3 Words Recived

BSPI_TrFifoDepth ( BSPI0 , 3 ); // 3 Words Transmit

}

void UseQ(void) {

if(GPIO_BitRead(GPIO2, 0x0A)==1)//if change

{

if(GPIO_BitRead(GPIO2, 0x09)==1)//if data ready

{

BSPI_BufferSend (BSPI0,Buff1Out,3 );// this should send the words

BSPI_BufferReceive(BSPI0,Buff1In ,3 );// put the data recived into my buffer

}

}

}

kaouther
Associate II
Posted on December 03, 2007 at 13:41

Dear noz4r2,

A helpfull basic configuration of BSPI in Master and slave mode is available in the

http://www.st.com/mcu/download2.php?file=str71xfwlib.zip&info=STR7 Software STR71x&url=http://www.st.com/stonline/products/support/micro/files/str71xfwlib.zip

V4.0. New example for BSPI using interrupt is added as well. Please refer to readme.txt file for the hardware connectivity.