cancel
Showing results for 
Search instead for 
Did you mean: 

2 STM32F4 Communication using SPI1 ( Urgent )

adarsh
Associate II
Posted on March 18, 2015 at 11:59

The original post was too long to process during our migration. Please click on the attachment to read the original post.
15 REPLIES 15
original
Associate II
Posted on March 19, 2015 at 10:21

Hi,

Like Clive said before, you can either check it as '!=RESET' or '==SET'.

But '==RESET' is exactly where you started from, so it will definitely not help.

adarsh
Associate II
Posted on March 19, 2015 at 11:46

Hi Kumar,

I have checked it as '!=RESET' or '==SET. By this it is not entering inside any of the case itself.

original
Associate II
Posted on March 19, 2015 at 12:12

Yes, it wouldn't enter the IF loop because Master has not yet sent any data over SPI. Did you check already if it doesn't work at all, irrespective of Master sending data or not?

adarsh
Associate II
Posted on March 19, 2015 at 12:38

Hi Kumar,

Now I have tried to test either master is sending via SPI or not, for that testing I have used small logic using leds that as below

GPIOE->BSRRH |= GPIO_Pin_7; // set PE7 (CS) low

 

SPI1_send(i);  // transmit data

 

GPIOD->BSRRL = 0x1000;    //Set LED1 (Green)

 

 

received_val = SPI1_send(0x00); // transmit dummy byte and receive data

 

GPIOD->BSRRL = 0x4000;    //Set LED3 (Red)

 

GPIOE->BSRRL |= GPIO_Pin_7; // set PE7 (CS) high

By testing like this both the green and red leds glowing its mean that master is sending and receiving that data right ?

Please correct me if i'm wrong anywhere.

original
Associate II
Posted on March 19, 2015 at 15:47

I wouldn't rely on the glowing LED's to test if the data has been sent by the Master, as it does not check the timings and the actual data being sent. It could also happen that the data is not going out from the pins, but your LED will glow anyway.

If you have an oscilloscope, then you can simply check if the signals are being sent and if the timings are correct.

Posted on March 19, 2015 at 15:49

Use an oscilloscope to confirm you have an SPI signal coming out of the Master. If you have  a logic analyzer even better. Use a debugger, SWV or USART to provide information about what you see at the SPI interface, both status and data registers.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..