I try to communicate with the CS5490 chip from Cirrus Logic
and my Clicker 2.
The communication use UART protocol and I use UART4. On UART3 I have the UART Click module from MikroE to see the datas "send to"/"receive from" the CS5490.
I have this initialization :
// The CS5490 provides a two-wire, asynchronous, full-duplex UART port.
// The CS5490 UART operates in 8-bit mode, which transmits a total of 10
// bits per byte. Data is transmitted and received LSB first, with one start bit,
// eight data bits, and one stop bit.
UART4_Init_Advanced(600, _UART_8_BIT_DATA, _UART_NOPARITY, _UART_ONE_STOPBIT, &_GPIO_MODULE_UART4_PA01);
The send/receive methods are :
void CS5490_send(BList *msg, uint8_t size)
for (i=0; i<size; i++)
uint8_t CS5490_read(uint8_t *size, BList *result)
int i = 0;
while (UART4_Data_Ready() == 1)
result->tab[i++] = (uint8_t)UART4_Read();
*size = i;
BList is simply an array of 3 bytes.
I have a problem with the read method : I receive only one byte.
But when I take a look at my signal analyser, I can see that the CS5490 send 3 bytes.
Why I read only 1 byte
Complete test program in attachment.