Skip to content

Commit

Permalink
RSI_send_error_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
thashok committed Nov 8, 2022
1 parent 0bff5ad commit 54c0788
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
16 changes: 15 additions & 1 deletion examples/platform/efr32/rs911x/hal/efx_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,24 @@ int16_t rsi_spi_transfer(uint8_t * tx_buf, uint8_t * rx_buf, uint16_t xlen, uint
/*
* Wait for the call-back to complete
*/
if (xSemaphoreTake(spi_sem, portMAX_DELAY) == pdTRUE)
if (xSemaphoreTake(spi_sem, pdMS_TO_TICKS(RSI_SEM_BLOCK_MIN_TICK_VALUE)) == pdTRUE)
{
xSemaphoreGive(spi_sem);
}
else
{
uint32_t ldma_flags = 0;
uint32_t rem_len = 0;
rem_len = LDMA_TransferRemainingCount(RSI_LDMA_TRANSFER_CHANNEL_NUM);
LDMA_StopTransfer(RSI_LDMA_TRANSFER_CHANNEL_NUM);
ldma_flags = LDMA_IntGet();
LDMA_IntClear(ldma_flags);
receiveDMA(rx_buf, rem_len);
if (xSemaphoreTake(spi_sem, portMAX_DELAY) == pdTRUE)
{
xSemaphoreGive(spi_sem);
}
}
}

return RSI_ERROR_NONE;
Expand Down
6 changes: 6 additions & 0 deletions examples/platform/efr32/rs911x/hal/rsi_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
// Macro to drive high value on GPIO
#define RSI_HAL_GPIO_HIGH 1

// Macro to drive LDMA channel number
#define RSI_LDMA_TRANSFER_CHANNEL_NUM 3

// Macro to drive semaphore block minimun tick value
#define RSI_SEM_BLOCK_MIN_TICK_VALUE 50

/******************************************************
* * Function Declarations
* ******************************************************/
Expand Down

0 comments on commit 54c0788

Please sign in to comment.