cancel
Showing results for 
Search instead for 
Did you mean: 

what's the problem?

idrissmc
Associate III

hello everyone,

can someone help me please, I can't understand why I can't receive 7, it's weird...

I sent 7 , i want to receive 7, but I receive 255, 0, 15.. all the values except 7, that's really insane.

0690X000009ZeWtQAK.png

20 REPLIES 20

Hi.

What SPI pins connection?

Why you send aTx 3 times? Use variable for transmit result. Like this:

HAL_StatusTypeDef  status = HAL_SPI_Transmit(&SpiHandle, aTx, 1, 1000);
 
if(status == HAL_OK) {
 BSP_LED_On(LED4);
} 
else if(status == HAL_TIMEOUT{
 TimeoutErrorHandler();
}

#define SPIx_SCK_PIN           GPIO_PIN_10

#define SPIx_SCK_GPIO_PORT        GPIOB

#define SPIx_SCK_AF           GPIO_AF5_SPI2

#define SPIx_MISO_PIN          GPIO_PIN_14

#define SPIx_MISO_GPIO_PORT       GPIOB

#define SPIx_MISO_AF           GPIO_AF5_SPI2

#define SPIx_MOSI_PIN          GPIO_PIN_15

#define SPIx_MOSI_GPIO_PORT       GPIOB

#define SPIx_MOSI_AF           GPIO_AF5_SPI2

SPI2 on the F411E-disco

JChau
Associate II

Please describe your hardware configuration? You are looping back or you are sending/receiving with other devices?

idrissmc
Associate III

@JChau​ i'm using 2 boards (F413H-disco(slave/ spi3) and F411E-disco(master/spi2))

I followed the configuration described on both datasheet but I receive 0 on the slave card, althought the master card send 7(on live expression)

maybe I missed something, can you suggest you idea please

0690X000009ZeeEQAS.png0690X000009ZedzQAC.png

SPI pins connected with other board?

idrissmc
Associate III

0690X000009ZehDQAS.jpgyes i want to display the value on the second board bc it has an LCD.

JChau
Associate II

my experience is it is not software but hardware problem.

  1. Make sure both ground is tied, I cannot see ground wire shared
  2. I also had wire noise problem (bad contact on jumper head) that caused spikes on clock so the slave clocked in unwanted bits.
  3. If you havea logic analyzer, hook it up and see the bits sending and receiving

EDIT: receiving 0 or 255 is most probably that data pin has bad contact,

idrissmc
Associate III

@JChau​  it displays always 0, there's like no connection between the 2 boards. it drives me crazy, I can't understand what's missing!

I think I have the same problem with noise bc when I tried with one board, the value change between 255 and 7, and when I press the ST_link, it still 7, but my problem i want at least see something on the LCD, but not 0

if you think it is noise, or bad contact, you have to solder the wire instead, btw we did solder the wire, and even used shielded wire (because problem persisted until we found that part of it is a silicon problem for I2S, which is not your case)