AnsweredAssumed Answered


Question asked by bodnarchuk.roman on Jun 1, 2016

I'm trying to communicate with ADC through SPI interface with HAL layer and ended up with issues.

At start I configure adc:

HAL_SPI_Transmit(&hspi1, &SDATAC, 1, 3);     //0x16
HAL_GPIO_WritePin(GPIOC, START_Pin, GPIO_PIN_SET);               
HAL_SPI_Transmit(&hspi1, WREG1, 3, 3);      {0x43, 0x00, 0x00}
HAL_SPI_Transmit(&hspi1, WREG2, 3, 3);      {0x42, 0x00, 0x30}
HAL_SPI_Transmit(&hspi1, WREG3, 4, 3);           {0x4a, 0x01, 0x06, 0x0f}
HAL_SPI_Transmit(&hspi1, &RDATAC, 1, 3);     //0x12

and waiting for falling edge interrupt(data ready signal from adc):

void EXTI9_5_IRQHandler(void)

     HAL_SPI_TransmitReceive_DMA(&hspi1, NOP, cdata, 6); 
//NOP = {0xff, 0xff, 0xff,}


And here's what I get:


Why after transmitting and receiving 6 bytes as specified, my previous data being transmitted(HAL_SPI_Transmit(&hspi1, WREG1, 3, 3) WREG = {0x43, 0x00, 0x00})?