kendryte / kendryte-standalone-sdk

Standalone SDK for kendryte K210
https://kendryte.com
Apache License 2.0
440 stars 161 forks source link

SPI slave interface skip bytes. #127

Open Winnaries opened 3 years ago

Winnaries commented 3 years ago

Expected behavior

test_data[1024] values obtained from slave via READ_BLOCK should contains four repeats of numbers 0 to 255 and it should not skip any values.

Actual behavior

test_data[1024] values obtained from slave via READ_BLOCK skips 4 bytes for every 64 bytes sent. Already checked using Logic Analyzer.

/* intended */                  
idx            : [..., 62, 63, 64, 65, 66, 67, 68, 69, ...]
test_data[idx] : [..., 62, 63, 64, 65, 66, 67, 68, 69, ...]
                               ⌃⌃ 

/* actual */                   
idx            : [..., 62, 63, 64, 65, 66, 67, 68, 69, ...]
test_data[idx] : [..., 62, 63, 68, 69, 70, 71, 72, 73, ...]
                               ⌃⌃ 

Test code

Please follow this implementation https://github.com/kendryte/kendryte-standalone-demo/tree/develop/spi_slave, but instead of initializing test_data_temp[1024] values via master's WRITE_BLOCK, please initialize it in the slave itself.

Provide a Minimal, Complete, and Verifiable example which will reproduce the problem.

/* slave test_data init */
for (int i = 0; i < 1024; i++) {
    test_data_temp[i] = i % 256; 
}

Document version

I'm on branch develop.

Hardware

Sipeed M1W

System

linux_x86