cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f407 DIS with external ADC(MCP3201)

vinothraj
Associate II
Posted on August 24, 2012 at 17:25

Hi,

   i try to read the value from external adc by stm32f407.but i could not get the result from adc.MSP3201 is connected STM32f407 by SPI.MCP 3201does not have MOSI pin.the program runs good at 

SendChar('b')

; .the control is going to 

while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_RXNE) == RESET); repeatedly.

what i did mistakenly? did i correctly configure the  SPI2?i attached my programs.i need any suggestion from you.i have attached hiper terminal result also.please check it out

#adc
8 REPLIES 8
Posted on August 24, 2012 at 17:53

RCC_APB2PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);

APB1 surely?
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
vinothraj
Associate II
Posted on August 28, 2012 at 08:45

sorry for late reply.Thank for Your valuable reply. i did mistake in that place.

RCC_APB2PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);    //its Wrong one

RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);   //its correct one.

Again thank for You(clive1).

vinothraj
Associate II
Posted on August 29, 2012 at 13:19

after doing the clock correction,i got same result as like previous Result.Any suggestion?

frankmeyer9
Associate II
Posted on August 29, 2012 at 14:20

MCP 3201does not have MOSI pin  ...

It is obviously only a SPI slave device, so it does not have a MOSI pin (Master Out, Slave In).

The Dout pin of the ADC thus needs to be connected to the controllers MISO pin.

Check if your wiring is correct.

vinothraj
Associate II
Posted on August 29, 2012 at 17:15

Thank for your response(fm).But its not my doubt.i knew that external adc has no Din.And i also connected the Dout of the external adc to MISO of stm32f4.MY problem is  that i did not get positive result from adc.the control is arrested in this place 

while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_RXNE) == RESET);

frankmeyer9
Associate II
Posted on August 29, 2012 at 20:03

i knew that external adc has no Din.And i also connected the Dout of the external adc to MISO of stm32f4

 

O.k., this was not clear from your first post.

That is a good point to bring a scope into play, to observe the signals at the pins. Can you see the clock ? Do you see outgoing data on Dout if you disconnect Dout from MISO ?

The result would point to the source of your problems.

vinothraj
Associate II
Posted on August 30, 2012 at 07:24

i do not have Scope,, to observe the signals at the pins.So i can not see.

vinothraj
Associate II
Posted on August 30, 2012 at 13:01

yes. i got a value from external adc(mcp3201, mcp3208).

Thank for your support.(Clive1 and fm)

:)i learn from mistakes..