2022-10-27 01:47 PM
2022-10-28 03:01 AM
Hard luck.
I don't know what you mean "32 bits per transfer", SPI in 'F407 is constrained to 8-bit or 16-bit, see SPI_CR1.DFF.
Solution depends on the slave and your expectations. Some SPI slaves don't mind if you clock more between framing signal transitions, so you can e.g. transfer 3x16=48 bits and just ignore the rest.
You always can bit-bang the protocol in some way.
JW
2022-10-28 06:30 AM
The encoder documentation describes the returned data as below. There are 18 bits of data. The communication begins with an opcode, in this case 0xA6, followed by the data. There is then a bit to show error, if any, then a warning bit, followed by a six-bit CRC. These are the 34 bits I was describing. We must input the data, then check the warning and error bits, test the CRC and, if all is OK, translate the data to an angular measurement. I was hoping that I could read the 34 bits with one transfer, then do the parsing. That doesn't seem possible with the F407.
x
As you can imagine, there are many other processes occurring here. But it sounds like bit banging is probably the only way.
Thank you for responding.
2022-10-28 06:52 AM
Check if the device accepts 40 bit sent w/o problem. Check if you have time to bit-bang the 34 SPI bits. Consider a more modern STM32 that can transfer 4..16 bits per call and switch the bit width during transmission.
2022-10-29 07:48 PM
A slave chip to sell well should be easily compatible with most masters in the masket. Something weird here. As you transmit and receive with spu, check if 64 clocks (extra spare clocks) works. And as said by others, newer stm32 spi should be able to handle 17 bit chunck with fifo and dma.
2022-10-30 12:13 PM
E.g. the HX711 weight sensor uses 25/26/27 SCK pulses. So people use bitbanging. But a 50 microsecond also resets the device. So if the CPU is busy for some time while SCK is already high, unexpected results happen. A lot of people got biten by that...
2022-10-31 06:23 AM
Yes, I can see that I will have to do the "bit banging". I was hoping to have things done automatically. I think there is enough time, but I haven't gotten to the point of checking the details. I'm using an STM32F4-Discovery just for testing. My motor controls will be done by the m4 processor of the STM32MP151. It's more complicated, so I was hoping to avoid needless complexity. Thanks very much for your help.
2022-10-31 07:17 AM
with STM32MP151 is spi possible , just look im RM setting spi to 17 bit transfer;
then set circular DMA, 4 data words; on half-/full callback you get complete data .