2007-12-03 10:17 PM
New trouble with slave pin (BSPI)
2007-11-08 04:14 AM
Ok i had everything working except the slave select which i have now learnt doesnt work when the st710 as master , so i swapped the slave wire to port 0 pin 12 and then fed the SS pin (port 0 pin 3) with the +3V found on the board with a 10k resistor. But now nothing works and was wondering if anyone could help me. please see my code below which was working before i swapped the slave wire.
Code:
void InitaliseQTouch(void) { // P0.0 ''MISO'' // P0.1 ''MOSI'' // P0.2 ''SCLK'' // P0.3 ''Old SS'' // P2.9 ''DRDY'' // P2.10 ''CHANGE'' // P0.12 ''SS'' GPIO_Config (GPIO0,(1<<1)|(1<<2)|(1<<12), GPIO_AF_PP); // set up port pins. GPIO_Config(GPIO0,(1<<3),GPIO_IN_TRI_CMOS);//Old SS GPIO_Config(GPIO0,0,GPIO_IN_TRI_CMOS);//MISO 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 ,ENABLE);//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 { GPIO_BitWrite(GPIO0,12,0x00); BSPI_BufferSend (BSPI0,Buff1Out,3 );// this should send the words BSPI_BufferReceive(BSPI0,Buff1In ,3 );// put the data recived into my buffer GPIO_BitWrite(GPIO0,12,0x01); } } }2007-12-03 04:42 AM
Dear noz4r2,
A helpfull example of BSPI basic configuration in Master and slave mode is available in thehttp://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. Enjoy ;) [ This message was edited by: coucou on 03-12-2007 18:54 ]2007-12-03 10:17 PM
Is there also an example available for the STR73x?
i found two examples but those are maybe a little bit to expanded for my purpose. I will look for a bit easier solution, someone?[ This message was edited by: basvandijk86 on 04-12-2007 11:53 ]