I am trying to read 64 inputs using chain of 8 74HC165 shift registers via spi like described in this article http://www.avrfreaks.net/index.php?name ... w=previous. Communication looks fine on oscilloscope (NSS, clock, MISO). But first received byte contains only 7 bits of data and 9-th byte contains last one bit. Using uint16_t data words produces similar results: first data word contains 15 bits of data and the last bit lays in 5-th word.
My spi config.
Code: Select all
static const SPIConfig in_spicfg = {
NULL,
GPIOB,
GPIOB_SR_IN_NSS,
SPI_CR1_CPOL | SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0
};Code reading data:
Code: Select all
spiAcquireBus(spip);
spiStart(spip, &in_spicfg);
spiSelect(spip);
spiReceive(spip, n, rxbuf);
spiUnselect(spip);
spiReleaseBus(spip); Yes, I can construct single uint64_t from 9 uint8_t, but what I do wrong?