Skip to content

SPI disable deleay is zero when SPI clock > 1MHz #2181

Closed
@jchen-dawnscene

Description

@jchen-dawnscene

It is related to:
#1294

Although the issue above is fixed by pull request #1506, there is a small glitch.
In spi_com.c, compute_disable_delay(), spi disable delay is calculated by:

disable_delay = ((prescaler * 1000000) / spi_freq) / 2;

if the spi clock > 1MHz, i.e. spi_freq / prescaler > 1000000, disable_delay is 0, which actually make this fix invalid.

The solution shall be:

disable_delay = ((prescaler * 1000000) / spi_freq) / 2 + 1;

It was tested to work on our environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions