Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 2

How to read data from external ADC MAX144 using STM32 microcontroller

I am facing a problem for last week in reading data from external ADC MAX144 using SPI and STM32L452. The confusion is how to receive data in buffer as there is no memory address or control register address is mentioned in the datasheet of ADC. The datasheet ADC is given below.

https://datasheets.maximintegrated.com/en/ds/MAX144-MAX145.pdf

What I tried is:

  1. I made a buffer of 2 bytes. (static unit_8 readBuffer[2])

  2. Then used receive command of HAL SPI ( HAL_SPI_Receive(&hspi3, readBuffer, 2, 5000)

  3. And transmit through USART to PC

The confusion is I am not giving any memory address or control register address for reading data as nothing about registers is mentioned in the datasheet of ADC and it is continuously sending data.

Please guide me someone has any idea about it. I stuck in this problem but don't understand it. Any leads will be highly appreciated.

Regards,

1 Reply
Commander Lvl 2
Message 2 of 2

Re: How to read data from external ADC MAX144 using STM32 microcontroller

I'm not familar with the STM32 or MAX144, but some digging suggests you might look at this post.

 

I.e. what you have now:

HAL_SPI_Receive(&hspi3, readBuffer, 2, 5000)

probably needs to change to:

HAL_SPI_Receive(&hspi3, &readBuffer, 2, 5000);
// read bytes are now in readBuffer

or possibly:

uint8_t readByte;

// read first byte
HAL_SPI_Receive(&hspi3, &readByte, 1, 5000);
// readByte now contains first 8 bits of ADC data - store or send to PC

// read second byte
HAL_SPI_Receive(&hspi3, &readByte, 1, 5000);
// readByte now contains second 8 bits of ADC data - store or send to PC

This post also had some good information and resources which might help you learn how to use SPI.

 

Please follow-up to let us know how you made out. For good karma, mark a reply as the answer if it helped!