@@ -393,7 +393,7 @@ spi_status_e spi_send(spi_t *obj, uint8_t *Data, uint16_t len, uint32_t Timeout)
393
393
* @param rx_buffer : data to receive
394
394
* @param len : length in byte of the data to send and receive
395
395
* @param Timeout: Timeout duration in tick
396
- * @param skipRecieve : skip recieving data after transmit or not
396
+ * @param skipReceive : skip receiving data after transmit or not
397
397
* @retval status of the send operation (0) in case of error
398
398
*/
399
399
spi_status_e spi_transfer (spi_t * obj , uint8_t * tx_buffer , uint8_t * rx_buffer ,
@@ -407,14 +407,25 @@ spi_status_e spi_transfer(spi_t *obj, uint8_t *tx_buffer, uint8_t *rx_buffer,
407
407
return Timeout > 0U ? SPI_ERROR : SPI_TIMEOUT ;
408
408
}
409
409
tickstart = HAL_GetTick ();
410
+
411
+ #if defined(STM32H7xx ) || defined(STM32MP1xx )
412
+ LL_SPI_StartMasterTransfer (_SPI ); // start master transfer
413
+ #endif
414
+
410
415
while (size -- ) {
411
- while (!LL_SPI_IsActiveFlag_TXE (_SPI ))
412
- ;
416
+ #if defined(STM32H7xx ) || defined(STM32MP1xx )
417
+ while (!LL_SPI_IsActiveFlag_TXP (_SPI ));
418
+ #else
419
+ while (!LL_SPI_IsActiveFlag_TXE (_SPI ));
420
+ #endif
413
421
LL_SPI_TransmitData8 (_SPI , * tx_buffer ++ );
414
422
415
423
if (!skipReceive ) {
416
- while (!LL_SPI_IsActiveFlag_RXNE (_SPI ))
417
- ;
424
+ #if defined(STM32H7xx ) || defined(STM32MP1xx )
425
+ while (!LL_SPI_IsActiveFlag_RXP (_SPI ));
426
+ #else
427
+ while (!LL_SPI_IsActiveFlag_RXNE (_SPI ));
428
+ #endif
418
429
* rx_buffer ++ = LL_SPI_ReceiveData8 (_SPI );
419
430
}
420
431
if ((Timeout != HAL_MAX_DELAY ) && (HAL_GetTick () - tickstart >= Timeout )) {
0 commit comments