Xilinx / Xilinx/embeddedsw

PS SPI Polled transfer with manual SS and auto start does not properly work

Open
#42 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
1.2k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

The function XSpiPs_PolledTransfer checks the transfer completion by testing the flag XSPIPS_IXR_TXOW_MASK, which is reported to be the flag indicating the TX FIFO overwater, meant to be asserted whenever the content of TX FIFO crosses the configured watermark.
This causes an issue when the master is configured with the manual SS mode. Indeed, checking the XSPIPS_IXR_TXOW_MASK causes the de assertion of SS before the transfer is completed; this is due to the fact that the TX FIFO is being dequeued until it is empty when the master is configured with the auto start mode.

To resolve the problem, a simply work around can be adopted: instead of checking the XSPIPS_IXR_TXOW_MASK (raw 576 of xspips.c), it should be enough to check the condition XSPIPS_IXR_RXNEMPTY_MASK once the RX Watermark is set equal to the amount of byte queued into the TX fifo.
This will be eventually set since the counterpart device is going to sent backwards data during the master transfer, hence XSPIPS_IXR_RXNEMPTY_MASK will be asserted each time the TX fifo has been emptied.

So, probably there is the need to split up the XSpiPs_PolledTransfer into two versions: one with automatic SS and the other one with the manual SS; alternatively a branch over the SS mode can be adopted instead.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in xspips.c at raw 576, inside XSpiPs_PolledTransfer, and compare the TXOW and RXNEMPTY completion checks. Trace how manual SS, automatic SS, auto start, and the RX watermark interact. Done means polled transfers complete without deasserting manual SS before the transfer finishes, while automatic-SS behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.