Closed pvvx closed 1 year ago
Only support 32bit, so disable it.
unsigned int SPI_ReadInvBMode(unsigned int wrdata, unsigned int size) {
bflb_spi_feature_control(uspi0, SPI_CMD_SET_DATA_WIDTH, size);
unsigned int regval = bflb_spi_poll_send(uspi0, wrdata);
unsigned int i = 4 - size;
while (i--)
regval >>= 8;
return regval;
}
Otherwise, it is not convenient to work with AD717x type ADC. There, registers have different lengths (8, 16, 24 bits) and it is easier to set a command fixed in the high byte.
static unsigned int rdreg_ad717x(ad717x_st_reg *p) {
bflb_spi_feature_control(uspi0, SPI_CMD_SET_DATA_WIDTH, p->size + 1);
unsigned int rval = (bflb_spi_poll_send(uspi0, ((p->addr & 0x3f) << 24) | 0x40000000))
& 0x00ffffff;
unsigned int i = 3 - p->size;
while (i--)
rval >>= 8;
p->value = rval;
return rval;
}
As well as other applications.
SPI BL702 - no "Byte-inverse signal for FIFO" option? SPI_BYTE_MSB https://github.com/bouffalolab/bl_mcu_sdk/blob/master/drivers/lhal/include/bflb_spi.h#L66
BL702/704/706 Reference Manual:
With SPI_BYTE_MSB is set, SPI works correctly on the test board with BL702C10.