cancel
Showing results for 
Search instead for 
Did you mean: 

TSensor example in STM32F10x_StdPeriph_Lib_V3.5.0

zabel
Associate III
Posted on September 09, 2011 at 10:41

Hi,

I got the temperature sensor example form the standard library and it works fine on my STM3210E-EVAL board. But I would like to know, why the FSMC must be disabled before a I2C communication is performed.

In every iteraten there is the sequence:

#ifdef USE_STM3210E_EVAL        

    /* Disable FSMC */

    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, DISABLE);

    /* Initialize the Temperature Sensor */

    LM75_Init();

#endif /* USE_STM3210E_EVAL */     

      /* Get double of Temperature value */

      TempValue = LM75_ReadTemp();

#ifdef USE_STM3210E_EVAL          

      /* Enable FSMC */

      RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);

#endif /* USE_STM3210E_EVAL */

I tried to comment out the disable/enable calls, and this indeed resulted in not working the example (I get always the same value then), so the disable/enable seems indeed to be needed.

But why is this necessary?

Regards

  Dirk

4 REPLIES 4
Andrew Neil
Chief III
Posted on September 09, 2011 at 11:40

The fact that it's conditional on a flag called USE_STM3210E_EVAL suggests that it's something specifically to do with the STM3210E-EVAL board - doesn't it?

So:

* Do the STM3210E-EVAL board schematics give any clue?

* Is there anything in the STM3210E-EVAL board's User Guide about this?

zabel
Associate III
Posted on September 09, 2011 at 12:03

> The fact that it's conditional on a flag called USE_STM3210E_EVAL suggests that it's

> something specifically to do with the STM3210E-EVAL board - doesn't it?

sure.

> * Do the STM3210E-EVAL board schematics give any clue?

No, the temperature sensor is connected to PB5 (INT), PB6 (SCL) and PB7 (SDA). I don't see how this interferes with the FSMC

> * Is there anything in the STM3210E-EVAL board's User Guide about this?

Nothing.

Regards

  Dirk

Posted on September 09, 2011 at 16:20

No, the temperature sensor is connected to PB5 (INT), PB6 (SCL) and PB7 (SDA). I don't see how this interferes with the FSMC

 

PB7  = I2C1_SDA, FSMC_NADV, TIM4_CH2 (Remap:USART1_TX)

Is this sufficiently illuminating?

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
zabel
Associate III
Posted on September 12, 2011 at 14:38

Thanks, yes. The FSMC_NADV signal is not used on the eval board, but I think it es nevertheless driven as long as the FSMC clock is running.

NB: just found in the errata, that switching off the FSMC clock is a suggested workaround due the to conflict between I2C1 SDA and FSMC_NADV.

This leads to another problem I have but this will be a new thread.

Regards

  Dirk