Skip to main content
Philip Westphal
Associate II
May 30, 2018
Solved

Using the ADC MCP3903 via the MCU STM32F072RBT6

  • May 30, 2018
  • 2 replies
  • 1100 views
Posted on May 30, 2018 at 11:15

Hi there, I am new to this community and recently started using STM32 mcus. There is still alot I do not know about 

this subject so please bear with me. I am trying to get familiar with using these mcus and would therefore make

a simple datalogger using the STM32F072RBT6 in combination with the ADC MCP3903.

While I found a library for arduino, I could not find anything for STM.

http://www.kerrywong.com/2014/05/10/mcp3903-library/

  

-Does such a library exists? If not, Is it possible to convert it so that it can be used in the described combination?

-If that does not work either, do you know of a different ADC with similar capabilities where libraries already exist?

Thank you very much for your time and help.

    This topic has been closed for replies.
    Best answer by David SIORPAES
    Posted on May 30, 2018 at 18:35

    The library seems pretty easy to port to Cube environment.

    Re-write the readRegister()/writeRegister() methods using HAL_SPI_TransmitReceive instead of SPI.Transfer() and use HAL_GPIO_WritePin instead of digitalWrite().

    2 replies

    T J
    Senior III
    May 30, 2018
    Posted on May 30, 2018 at 18:08

    just mimic the functionality described on page 31 of the MCP3903 data sheet

    its an easy detailed explanation.

    Do you have a scope or logic analyzer ?

    Philip Westphal
    Associate II
    May 31, 2018
    Posted on May 31, 2018 at 12:39

    Unfortunately, I neither have a scope nor a logic analyzer. I am not sure what I need to look at on page 31. 

    David SIORPAES
    David SIORPAESBest answer
    ST Employee
    May 30, 2018
    Posted on May 30, 2018 at 18:35

    The library seems pretty easy to port to Cube environment.

    Re-write the readRegister()/writeRegister() methods using HAL_SPI_TransmitReceive instead of SPI.Transfer() and use HAL_GPIO_WritePin instead of digitalWrite().

    Philip Westphal
    Associate II
    May 31, 2018
    Posted on May 31, 2018 at 12:40

    Thank you, I will try that.