Skip to content
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

SPI chip select set incorrectly #219

Open
jamolnng opened this issue Jan 4, 2020 · 1 comment
Open

SPI chip select set incorrectly #219

jamolnng opened this issue Jan 4, 2020 · 1 comment

Comments

@jamolnng
Copy link

jamolnng commented Jan 4, 2020

According to the FE310 Manual the csid register is log2(cs_width)

This implies:

For SPI 0x10024000

Binary CS
00 CS0
01 CS1
10 CS2
11 CS3

However, in the code https://github.com/sifive/freedom-metal/blob/v201908-branch/src/drivers/sifive_spi0.c#L117 it is set like a cs_width register where each bit corresponds to each chip select line. So the register would act like this

For SPI 0x10024000

Binary CS
0001 CS0
0010 CS1
0100 CS2
1000 CS3

A fix would be

/* Set CS line */
METAL_SPI_REGW(METAL_SIFIVE_SPI0_CSID) = config->csid;
@nategraff-sifive
Copy link
Contributor

Thanks for this too @jamolnng!

bsousi5 pushed a commit that referenced this issue Apr 8, 2020
Rename example-coreip-welcome to sifive-welcome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants