-
Notifications
You must be signed in to change notification settings - Fork 181
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
How to use SPI Half-Duplex Mode #339
Comments
Welcome and thanks for reporting. I think there might be a bug inside the read path of the transfer, when used in half3wire mode , but have to investigate a bit further. |
.duplex(esp_idf_hal::spi::config::Duplex::Half3Wire) and spi_dev.transfer(&mut read_buf, &[0x80 | 0x01, 0x00])?; are incompatible. What you probably want to do there is this. spi_dev.transaction(&mut [Operation::Read(&mut read_buf), Operation::Write(&[0x80 | 0x01, 0x00]))?; EDIT: Actually, thinking about it a bit more, you're probably wanting to write first. Up to you to decide 😄 spi_dev.transaction(&mut [Operation::Write(&[0x80 | 0x01, 0x00]), Operation::Read(&mut read_buf))?; |
I tried to solve the problem with your code, but it returned the same error. When I did not select any Duplex (which should be Full-Duplex at this time), the final read_buf only has 0xF. |
I see. Looks like @Vollbrecht discovered this as well. From a quick glance it appears we should be setting this to zero in half duplex mode. This comment should've been taken care of when half duplex was added in this PR. Though I'm a little surprised no one has encountered this issue yet. |
I also have the same question,"Half3Wire" how to use? |
solution: espressif/esp-idf#13554 |
new solution: #459 |
Closing as it is now merged! Thanks, |
I'm a beginner of rust embedded development of esp32. I want to drive DS1302 with Half3Wire-Duplex Mode, but code below didn't work.
The serial output is as follows
It seems that I am missing some configurations, but I don't know what I'm missing.
The text was updated successfully, but these errors were encountered: