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

docs/spi: add information for data size #2210

Closed
wants to merge 1 commit into from
Closed

docs/spi: add information for data size #2210

wants to merge 1 commit into from

Conversation

toolmacher
Copy link

Hi,
think that was forgotten: data size description of bits in the class SPI. I added the information that the data size can also be 16.

@@ -66,6 +66,7 @@ Methods
use of ``prescaler`` overrides ``baudrate``.
- ``polarity`` can be 0 or 1, and is the level the idle clock line sits at.
- ``phase`` can be 0 or 1 to sample data on the first or second clock edge
- ``bits`` can be 8 or 16, and is the data size.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would find "and is the data size" part a bit confusing, why I don't merge this and leave for further review/discussion.

Copy link
Author

Choose a reason for hiding this comment

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

how about:
"bits can be 8 or 16, stands for the data bytes"
or
" bits can be 8 or 16, and is the word size"

Copy link

Choose a reason for hiding this comment

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

I think it usually called the word size

bits word size - can be 8 or 16.

@dpgeorge
Copy link
Member

Which port are you using that supports 16 bits wide SPI words?

@toolmacher
Copy link
Author

I use v1.8.1.
https://github.com/micropython/micropython/blob/master/stmhal/spi.c#L439
I measured it with the oscilloscope and it works.
>>> from pyb import SPI
>>> spi = SPI(1,SPI.MASTER,baudrate=1000,polarity=1,phase=0,bits=16)
>>> spi.send_recv(5)

@dpgeorge
Copy link
Member

I see, then the stmhal code works by accident, that's nice to know!

Regarding the docs, how about: "can be 8 or 16, and is the number of bits in each transferred word"

pfalcon added a commit that referenced this pull request Sep 18, 2016
@pfalcon
Copy link
Contributor

pfalcon commented Sep 18, 2016

Applied with @dpgeorge's wording.

@pfalcon pfalcon closed this Sep 18, 2016
MarkR42 pushed a commit to MarkR42/micropython that referenced this pull request Oct 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants