This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi, I am using HALCoGen to set up a project for an RM44 chip.
I will connect to a PLL from Analog Devices which uses a 3-wire SPI connection.
By 3-wire I mean CLK, DATA and CS.
However, the SPI driver from HALCoGen appears to wait for a read flag:
uint32 spiTransmitData(spiBASE_t *spi, spiDAT1_t *dataconfig_t, uint32 blocksize, uint16 * srcbuff) { /** Code skipped here for simplicity */
/*SAFETYMCUSW 567 S MR:17.1,17.4 <APPROVED> "Pointer increment needed" */ srcbuff++; /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Hardware status bit read check" */ while((spi->FLG & 0x00000100U) != 0x00000100U) { } /* Wait */ SpiBuf = spi->BUF; blocksize--; } return (spi->FLG & 0xFFU); }
From what I understand, the red code waits for the RXINTFLG to be set, which will never happen because it is using 3-wire.
Have I understood this correctly? If so, the HALCoGen drivers does not support 3-wire mode, which is a bit odd.
Is there a way around this?
Hello Audun,
Normally three-pin mode in our TRM means the CS (chip select) is not used. The SPI master provides the serial clock to the SPICLK pin. The data is transmitted on the SPISOMI pin, and received on the SPISOMI pin. All SPI devices should have at least 4 pins (CS, CLK, SIMO, SOMI).
If you don't use SOMI, and only write the data to SPI device, you need to modify the code generated by HALCoGen. But this kind of configuration is not common.
Regards,
QJ