cancel
Showing results for 
Search instead for 
Did you mean: 

BSPIO doesn't work ! !

jorge2399
Associate II
Posted on September 11, 2006 at 07:26

BSPIO doesn't work ! !

9 REPLIES 9
jorge2399
Associate II
Posted on August 31, 2006 at 10:36

Hi all ,

I'm working on STR71x implementing SPI link between STR712 and a slave device.

I coded the spi link according to specifications and ST examples. It doesn't work. I haven't nothing on SCLK pin, and the link is not done. Like if the IO should be bad configured. But it's seem not tobe that (i copied ST examples, and post forums).

I encountered the problem with another guy on ST forum but without reply.

So , I try to find support. It's quite urgent and I need to succeed quickly to speak with my spi device.

My Code :

void main(void)

{

#ifdef DEBUG

debug();

#endif

/* RCCU peripheral configuration --------*/

//RCCU_Div2Config ( DISABLE);

/* Configure FCLK = RCLK /2 */

RCCU_FCLKConfig ( RCCU_DEFAULT );

/* Configure PCLK = RCLK /4 */

RCCU_PCLKConfig (RCCU_DEFAULT);

/* Configure MCLK clock for the CPU, RCCU_DEFAULT = RCLK /1 */

RCCU_MCLKConfig (RCCU_DEFAULT);

/* Configure the PLL1 ( * 12 , / 2 ) */

RCCU_PLL1Config (RCCU_PLL1_Mul_12, RCCU_Div_6) ;

/* Wait PLL to lock */

while(RCCU_FlagStatus(RCCU_PLL1_LOCK)==RESET);

/* Select PLL1_Output as RCLK clock */

RCCU_RCLKSourceConfig (RCCU_PLL1_Output) ;

/* Configure GPI00 on mode Alternate function Push Pull */

GPIO_Config (GPIO0, 0x0077,GPIO_AF_PP );

GPIO_Config (GPIO0, 0x0080, GPIO_IN_TRI_CMOS);

GPIO_Config (GPIO0, 0x0008, GPIO_IN_TRI_CMOS);

/* ---------

Configure BSPI0 as a Master

--------- */

/* Enable the BSPI0 interface */

Sendtab[0]=0x01;

Sendtab[1]=0x02;

BSPI_BSPI0Conf(ENABLE);

/* Initialize BSPI0 */

BSPI_Init ( BSPI0 ) ;

/* Configure Baud rate Frequency: ---> APB1/6 */

BSPI_ClockDividerConfig ( BSPI0, 6);

/* Enable BSPI0 */

BSPI_Enable ( BSPI0 , ENABLE );

/* Configure BSPI0 as a Master */

BSPI_MasterEnable ( BSPI0,ENABLE);

/* Configure the clock to be active high */

BSPI_ClkActiveHigh(BSPI0,ENABLE);

/* Enable capturing the first Data sample on the first edge of SCK */

BSPI_ClkFEdge(BSPI0,ENABLE);

/* Set the word length to 16 bit */

BSPI_8bLEn(BSPI0,ENABLE);

/* Configure the depth of transmit to 9 words */

BSPI_TrFifoDepth(BSPI0,9);

/* Configure the depth of receive to 9 word */

BSPI_RcFifoDepth(BSPI0,40);

/* ---------

Configue BSPI1 for nothing just in case of perturbation on bspi0 ?!

--------- */

/* Initialize BSPI1 */

BSPI_Init ( BSPI1 ) ;

/* Enable BSPI1 */

BSPI_Enable ( BSPI1 , DISABLE );

/* Configure BSPI0 as a Slave */

BSPI_MasterEnable ( BSPI1,DISABLE);

/*-----------

SPI LINK

------------*/

//putting down /CS

GPIO_BitWrite(GPIO0, 3,0) ;

//At this time CS is down but ther's no CLK

//Sending two words

BSPI_BufferSend(BSPI1,Sendtab,2);

//Nothing on scope too during sent

BSPI_BufferReceive(BSPI1,Receivetab,9);

GPIO_BitWrite(GPIO0, 3, 1) ;

while(1);

}

So If you had some problem on spi implementation on STR71x, please don't hesitate to post.

Moreover, if the problem is known on the ST side, please signal it.

Thanks much,

Regards,

[ This message was edited by: jorge50 on 31-08-2006 14:15 ]

strerieux9
Associate II
Posted on September 01, 2006 at 12:15

you put BSPI1 in the place of BSPI0

//Sending two words

BSPI_BufferSend(BSPI0,Sendtab,2);

regards

raainxx

jorge2399
Associate II
Posted on September 01, 2006 at 12:26

OH ok Rainxx,

so, it's a mistake of me coz I tried with BSPI1 too.:-?

But it doesn'work with BSPI0 too, with :

//Sending two words

BSPI_BufferSend(BSPI0,Sendtab,2);

strerieux9
Associate II
Posted on September 01, 2006 at 12:31

have you take a pull-up resistor on the signal ss0 10K?

jorge2399
Associate II
Posted on September 01, 2006 at 12:36

No I didn't tried.

SS0 is in GPIO_IN_TRI_CMOS,

so, Is pull up integrated in STR71x , seems to be?

I'm going to try now you're suggestions and reply you in few minutes.

Thanks Raainxx

jorge2399
Associate II
Posted on September 01, 2006 at 12:46

Nothing Changed.

The SS0 work well on scope

but there's no CLK on scope after powering down SS0 ???!

strerieux9
Associate II
Posted on September 01, 2006 at 12:47

I have to see that on the pdf for interfaced str712 BSPI to M25P10

on st.

[ This message was edited by: Raainxx on 01-09-2006 16:18 ]

jorge2399
Associate II
Posted on September 04, 2006 at 11:11

Hi Radix

I think that's what i've done in code above, isn't it???

jorge2399
Associate II
Posted on September 07, 2006 at 11:21

Hi all,

I had a look to your code solartron, it helped me correct some details.

So, finally , i managed to use SPI bus ! :-]

One of my problems was APB bus not activated, and pull up not existant on MISO (due to my external SPI device). So, ........

I would like to mention for other developpers that ST SPI Chip select

is a CS. And not a /CS like in a lot of SPI IC connected to microcontrollers.

So, Be carreful,.....

Thanks to everybody helped me on this subject !