-
Notifications
You must be signed in to change notification settings - Fork 7k
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
[TW#23413] spi master management of byte order when the size of not byte aligned is crazy #2062
Comments
Hi,@Jegeva |
Any update? Hi @Jegeva, Could you provide a test project so we can reproduce the problem and help solve it? Thanks. |
Hi @Jegeva , In such systems, an unit32_t variable a=0x12345678 is placed like following in the memory. However the DMA don't know how your data is organized (as uint8_t, uint16_t or uint32_t), it always assume your data are This is how ESP32 hardware works. To send uint16_t and uint32_t and even random length of data, please:
To resolve data received, please do in the reverse way. Example:
We plan to provide macros in the future version. Another notice, please take care that your variable sent to the driver should be 32-bit aligned. |
BTW, there're such issues with command and address fields, and are re-ordered by the driver: https://github.com/espressif/esp-idf/blob/master/components/driver/spi_master.c#L730 |
Dears,
Have been busy, I’ll make something soon
Sincerely
Le ven. 22 juin 2018 à 14:09, FayeY <notifications@github.com> a écrit :
… Any update?
Hi @Jegeva <https://github.com/Jegeva>,
Could you provide a test project so we can reproduce the problem and help
solve it?
Thanks.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2062 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEtfWYzRA9AykT4uHVK_XBH_hY04PfpVks5t_N5zgaJpZM4UmgCm>
.
|
Update:
|
Hi @Jegeva , |
----------------------------- Delete below -----------------------------
If your issue is a general question, starts similar to "How do I..", or is related to 3rd party development kits/libs, please discuss this on our community forum at esp32.com instead.
INSTRUCTIONS
----------------------------- Delete above -----------------------------
Environment
git rev-parse --short HEAD
to get the commit id.): 0e501e5Problem Description
//Detailed problem description goes here.
while sending data with the spi master :
void send_9(uint16_t data){
esp_err_t ret;
spi_transaction_t t;
uint16_t workaround = data;
memset(&t, 0, sizeof(t)); //Zero out the transaction
t.length=9; //Command is >9< bits
t.tx_buffer=&workaround; //The data is the cmd itself
ret=spi_device_transmit(spi, &t);//Transmit!
assert(ret==ESP_OK);
}
Expected Behavior
data_bit8, data_bit7,...,data_bit0 as expected
Actual Behavior
data_bit7,...,data_bit0,data_bit15 is sent (check with a logic analyser)
Steps to repropduce
hook an esp32 to a LA,
set it up to use VSPI
send 0x00ff with a size of 9 : 0b111111110 is sent
send 0x80ff with a size of 9 : 0b111111111 is sent
this makes no sense
// It helps if you attach a picture of your setup/wiring here.
Code to reproduce this issue
-> use the spi master exemple, change the size, test the patterns i explained with a LA.
// If your code is longer than 30 lines, GIST is preferred.
Debug Logs
Other items if possible
build
folder (note this may contain all the code details and symbols of your project.)The text was updated successfully, but these errors were encountered: