[SPI] problem with command phase

michprev
Posts: 92
Joined: Fri Aug 04, 2017 8:57 pm

[SPI] problem with command phase

Postby michprev » Wed May 02, 2018 4:23 pm

Hi,
I've been having quite a hard time figguring out why command phase in my SPI driver does not work. Eventually I discovered that it does not work with this code:

Code: Select all

target_device->user2.usr_command_bitlen = 15;
target_device->user2.usr_command_value = 0xA1B2;
target_device->user.usr_command = 1;

// start user command
target_device->cmd.usr = 1;
But works with this code (command length set after command value):

Code: Select all

target_device->user2.usr_command_value = 0xA1B2;
target_device->user2.usr_command_bitlen = 15;
target_device->user.usr_command = 1;

// start user command
target_device->cmd.usr = 1;
I also noticed that ESP-IDF uses this order (which does not work for me too):

Code: Select all

target_device->user2.usr_command_bitlen = 15;
target_device->user.usr_command = 1;
target_device->user2.usr_command_value = 0xA1B2;

// start user command
target_device->cmd.usr = 1;
So I am a bit confused. Anyone knows what is going on?

Who is online

Users browsing this forum: Google [Bot] and 89 guests