cancel
Showing results for 
Search instead for 
Did you mean: 

STR730 SPI problem

stankovic
Associate II
Posted on June 30, 2006 at 19:59

STR730 SPI problem

4 REPLIES 4
stankovic
Associate II
Posted on June 26, 2006 at 15:34

Hi,

I am using Raisonance dev. board with STR730FZ2 micro.

First sw worked fine, I made SPI communication between STR and AVR working (STR master) but I have been strugling for days to make SPI working when AVR is master and STR slave(wird, I agree, but I need this for the project).

As I can see basic problem is about configuring SS pin.

In ST example for BSPI all BSPI0 pins should be configured as AF (111 in PC0,1,2). All pins works fine, clock is there, but when I connect SS pin to pin that drives it (5V)it pull's it's voltage down to 1V!

In ST730 Ref. manual it is written that pin can be configured as input instead of AF and I tried that as well.

Data that STR send is than everywhere and it can't properly recognized data sent by AVR.

Any idea what can be problem?

I worked with SPI for years and never had such kind of problem.

Code for configuring BSPI0 pins:

GPIO6->PC0 |= 0x7800;

GPIO6->PC1 |= 0x7800;

GPIO6->PC2 |= 0x7800;

Thanks.

philip1
Associate II
Posted on June 28, 2006 at 13:38

I'm not certain but your code looks like you have programmed P6.14 to be a push pull TTL output (all control registers set to '1'). To operate as a slave BSPI the SS pin (P6.14) has to be an input, try '100' or '110' See the Port Configuration Table on page 78 of the STR73xF Reference Manual.

PhilipJ

stankovic
Associate II
Posted on June 29, 2006 at 17:45

>I'm not certain but your code looks like you have programmed P6.14 to be a >push pull TTL output (all control registers set to '1'). To operate as a >slave BSPI the SS pin (P6.14) has to be an input, try '100' or '110' See the >Port Configuration Table on page 78 of the STR73xF Reference Manual.

Thank you Philip.

You are right, but on same page 78 it is written:

''For AF input pin can be either in Input or AF configuration''.

In table above '111' can be PP if pin is output or TTL if pin is input(last row).

I assumed as SPI configured in slave mode if I choose AF it will be input, obviously I was wrong.

It looks like it can only be in Input configuration.

I tried this, behave in right way, but SPI didn't work.

Then I found bug on other side (as usual :-[ ) - there were peaks on clock that caused SPI counter to get confused and message wasn't right.

It is long story - I have to initialize and deinitialize SPI on other side.

And SPI finally works in this mode.

Now I am looking for information of accepted rise/fall time for STR73xx SPI clock, but it is not in newest datasheet.

Miodrag

stankovic
Associate II
Posted on June 30, 2006 at 19:59

Just to add - in STR library BSPI Example1 all SPI pins are defined as AF:

/* GPIO pins configuration ---------------------------------------------------*/

/* BSPI0 pins configuration */

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

GPIO_InitStructure.GPIO_Pins = GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 |

GPIO_PIN_14;

GPIO_Init(GPIO6, &GPIO_InitStructure);

And it was recommended in text that SS(P6.14) should be connected to VSS!