cancel
Showing results for 
Search instead for 
Did you mean: 

SPI test with other boards

Jeevan Rudramurthy
Associate II
Posted on December 18, 2017 at 06:49

Hi

We have tested the SPI example code provided from ST disco board  with other boards like atmel controller.

Atmel as master and ST disco board as slave.

We have connected

Atmel                ST/FPGA

MOSI                     MOSI

MISO                     MISO

SCK                         SCK

NSS                         NSS

We have set both board side clock frequency 86khz,

Clock Polarity 0

Clock phase 0

SPI Slave(ST) written data to master(Atmel) is below

we have observed the data as below table, other data we have attached.

Data                Binary           LSB/MSB      No of bit shift

0x20(Real)     0010 0000                -                     -

0x10               0001 0000           LSB                1 bit shift on right

0x80               1000 0000           MSB                2 bit shift on left

When we made slave(ST)side LSB or MSB orientation data shift is happening as above,

Can you please suggest me what is the issue.

the other data observed is attached.

3 REPLIES 3
S.Ma
Principal
Posted on December 18, 2017 at 07:50

Which STM32 is used? At which point of the communication the data to send out by slave is ready? Using interrupt and especially EXTI interrupt on the NSS pin?

Jeevan Rudramurthy
Associate II
Posted on December 19, 2017 at 11:07

We are using STM32F769I_Discovery board as slave 

SPI_SLAVE_SYNBYTE = 0x55

/**

* @brief Slave synchronization with Master

* @param None

* @retval None

*/

static void Slave_Synchro(void)

{

uint8_t txackbyte = SPI_SLAVE_SYNBYTE, rxackbyte = 0x00;

/* if (HAL_SPI_TransmitReceive_IT(&SpiHandle, (uint8_t *)&txackbyte, (uint8_t *)&rxackbyte, 1) != HAL_OK)

{

Error_Handler();

}*/

if (HAL_SPI_TransmitReceive(&SpiHandle, (uint8_t *)&txackbyte, (uint8_t *)&rxackbyte, 1, HAL_MAX_DELAY) != HAL_OK)

{

Error_Handler();

}

}

I have tried with both driver API's provided for interrupt method its not working  only for HAL_SPI_TransmitReceive only its working

Posted on December 19, 2017 at 11:59

Does HAL works properly for interrupts