Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
53a8aeb6
Commit
53a8aeb6
authored
Jun 03, 2015
by
Damien George
Browse files
stmhal: Fix slow SPI DMA transfers by removing wfi from DMA wait loop.
Addresses issue #1268.
parent
80f638fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
stmhal/spi.c
View file @
53a8aeb6
...
@@ -290,12 +290,14 @@ void spi_deinit(SPI_HandleTypeDef *spi) {
...
@@ -290,12 +290,14 @@ void spi_deinit(SPI_HandleTypeDef *spi) {
}
}
STATIC
HAL_StatusTypeDef
spi_wait_dma_finished
(
SPI_HandleTypeDef
*
spi
,
uint32_t
timeout
)
{
STATIC
HAL_StatusTypeDef
spi_wait_dma_finished
(
SPI_HandleTypeDef
*
spi
,
uint32_t
timeout
)
{
// Note: we can't use WFI to idle in this loop because the DMA completion
// interrupt may occur before the WFI. Hence we miss it and have to wait
// until the next sys-tick (up to 1ms).
uint32_t
start
=
HAL_GetTick
();
uint32_t
start
=
HAL_GetTick
();
while
(
HAL_SPI_GetState
(
spi
)
!=
HAL_SPI_STATE_READY
)
{
while
(
HAL_SPI_GetState
(
spi
)
!=
HAL_SPI_STATE_READY
)
{
if
(
HAL_GetTick
()
-
start
>=
timeout
)
{
if
(
HAL_GetTick
()
-
start
>=
timeout
)
{
return
HAL_TIMEOUT
;
return
HAL_TIMEOUT
;
}
}
__WFI
();
}
}
return
HAL_OK
;
return
HAL_OK
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment