Closed michprev closed 5 years ago
BUG REPORT
I am not sure what exactly means data_bit_length in spi_init but SPI does not seem to work when setting endian to 1. I would expect it to swap order of sent bytes or bits but SPI sends all zeroes instead.
data_bit_length
spi_init
endian
endian set to 1
endian set to 0
#include <stdio.h> #include "gpio.h" #include "bsp.h" #include "sysctl.h" #include "fpioa.h" #include "spi.h" int main() { gpio_init(); dmac_init(); sysctl_set_power_mode(SYSCTL_POWER_BANK0, SYSCTL_POWER_V33); sysctl_set_power_mode(SYSCTL_POWER_BANK1, SYSCTL_POWER_V33); sysctl_set_power_mode(SYSCTL_POWER_BANK2, SYSCTL_POWER_V33); sysctl_set_power_mode(SYSCTL_POWER_BANK3, SYSCTL_POWER_V33); sysctl_set_power_mode(SYSCTL_POWER_BANK4, SYSCTL_POWER_V33); sysctl_set_power_mode(SYSCTL_POWER_BANK5, SYSCTL_POWER_V33); sysctl_set_power_mode(SYSCTL_POWER_BANK6, SYSCTL_POWER_V18); sysctl_set_power_mode(SYSCTL_POWER_BANK7, SYSCTL_POWER_V18); fpioa_set_function(9, FUNC_SPI1_SCLK); fpioa_set_function(10, FUNC_SPI1_D0); fpioa_set_function(11, FUNC_SPI1_SS0); spi_init(SPI_DEVICE_1, SPI_WORK_MODE_0, SPI_FF_STANDARD, 8, 1); spi_set_clk_rate(SPI_DEVICE_1, 1000000); uint8_t cmd = 0xA5; uint8_t data[] = { 0x01, 0x20, 0x03, 0x40 }; while(1) { spi_send_data_standard(SPI_DEVICE_1, SPI_CHIP_SELECT_0, &cmd, 0, data, 4); sleep(1); } }
248fbcd
Sipeed Dan Dock
"endian" is used for dma when "data_bit_length" is greater than 8.
I am not sure what exactly means
data_bit_length
inspi_init
but SPI does not seem to work when settingendian
to 1. I would expect it to swap order of sent bytes or bits but SPI sends all zeroes instead.endian set to 1
endian set to 0
Test code
Document version
248fbcd
Hardware
Sipeed Dan Dock