Skip to content

[stm32] Disable MASRX in STM32H7 SPI #1230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

WasabiFan
Copy link
Contributor

Follow-up to 678fd9a and #1223.

The previous PR fixed the core bug but I still see conditions under which the peripheral enters "suspended" state and doesn't recover. I added some in-memory logging to trace execution of the function and I can see the following:

  1. TX FIFO is filled (16 bytes), all status flags report as expected. Peripheral is popping bytes and pushing received data essentially as fast as it can be enqueued.
  2. All 16 bytes are cleared from the RX FIFO. Status flags are as expected. Both FIFOs indicate empty.
  3. Fiber yield (takes a few us)
  4. When fiber yield completes, status flags are unchanged.
  5. TX loop pushes one byte. Immediately after the push, the peripheral enters SUSP state and doesn't recover.

It seems that once the RX FIFO has been cleared and emptied, the next transmitted byte always enters SUSP mode. It is unclear why this happens. This seems like a peripheral bug to me. There isn't any mention of this behavior in the errata.

I found that either limiting the FIFO usage to only 15 bytes or disabling MASRX is sufficient to fix the issue. When MASRX is not set, neither SUSP nor OVR are seen for the same transmit sequence. In other words, the SUSP state clearly isn't just triggered by the overrun state (it is attempting to suspend before it overruns) and it seems the suspend logic is buggy, or at least, doesn't work how I'd expect.

Since we don't use the suspend state, I disabled it.

Follow-up to 678fd9a and modm-io#1223.
It seems that once the RX FIFO has been cleared and emptied, the next
transmitted byte always enters SUSP mode. It is unclear why this
happens. When MASRX is not set, neither SUSP nor OVR are seen for the
same transmit sequence.
Copy link
Member

@chris-durand chris-durand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I can't think of any other explanation than a hardware bug. Since we don't use the suspend state, let's turn it off.

@salkinium salkinium merged commit e6b78f9 into modm-io:develop Nov 22, 2024
68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants