/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

Username:     
Password:     
             

Forum

# 1   2008-05-22 23:28:30 I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

armaniake
Member
From: USA, Texas
Registered: 2007-08-22
Posts: 38

I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

Hello,

I have a question on the support of the I2C2 on STPrimer.

If you look at the errata on the STM32, it is indicated in chapt. 2.6.6:

http://www.st.com/stonline/products/lit … /14574.pdf

Conditions
● I2C2 and SPI2 are clocked together or I2C2 and USART3 are clocked together
● I/O port pin PB12 is configured as an alternate function output

Description
● Conflict between the I2C2 SMBALERT signal (even if this function is not used) and
SPI2_NSS in output mode.
● Conflict between the I2C2 SMBALERT signal (even if this function is not used) and
USART3_CK.
● In these cases the I/O port pin PB12 is set to 1 by default if the I/O alternate function
output is selected and I2C2 is clocked.

Workaround
I2C2 SMBALERT can be used as an output if SPI2 is configured in master mode with NSS
in software mode.
I2C2 SMBALERT can be used in input mode if SPI2 is configured in master or slave mode
with NSS managed by software.
SPI2 cannot be used in any other configuration when I2C2 is being used.
USART3 must not be used in synchronous mode when I2C2 is being used.


I would like to know if the SPI2 usage for the MEMS meets the requirements explained above. If such, this would mean I cannot use I2C2 on STPrimer.


It looks like at least one of the condition mentioned above is met, as GPIO12 is used as an alternate function (USB Detach feature). And now that I have enabled the clock for I2C2 with:

RCC_APB1PeriphClockCmd( RCC_APB1Periph_I2C2, ENABLE );

I might have both conditions met, as I think SPI2 and I2C2 are both clocked.

However, it seems that we are using SMBAL as an input with S/W management:

SPI_InitStructure.SPI_NSS                 = SPI_NSS_Soft; // from (mems.c)

So, maybe there is no issue but could you confirm this, as the errata says that
SPI2 cannot be used in any other configuration when I2C2 is being used.

Thanks a lot,

Offline

 

# 2   2008-06-04 07:57:53 I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

The MEMS is connected to the STM32 with:
  - MISO, MOSI, SCK (SPI2),
  - CS (to select SPI access mode versus I2C).
The SPI2_NSS pin is NOT used as an alternate function but as a standard output (for detach feature).
I believe that the Primer should not be concerned by this errata.
Did you try?

Offline

 

# 3   2008-06-04 15:08:17 I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

armaniake
Member
From: USA, Texas
Registered: 2007-08-22
Posts: 38

Re: I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

Hi Francis,

I have tried, and it does not cause a problem.


Thank you,

Offline

 

# 4   2008-11-20 12:26:54 I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

Xbrain!34
New member
Registered: 2008-11-10
Posts: 1

Re: I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

Hi,

When you say that "you tried and it does not cause a problem. " What is the exact configuration you tried ?
Master or Slave ?

Did you tried it using DMA ?

I am interested in your experience about I2C.

I am right now having issue with SCL staying low but I need to have a deeper analysis.

Thanx per advance.

Sylvain P.

Offline

 

# 5   2008-11-20 13:17:30 I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

armaniake
Member
From: USA, Texas
Registered: 2007-08-22
Posts: 38

Re: I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

Hi,

I apologize but I have stopped using the STPrimer about a year ago, I think, because of the I2C problem. So, I do not remember all the details. I know that I was using the ST lib rev 1-0. I also used the example based on reading the EEPROM provided by ST. So, the Primer was the master. I was not using DMA or interrupt.

I had the SCK toggling. No problem on that side. But the STM32 I2C lib. was getting stuck at some point during the I2C RD. And when that happened, we basically entered in an infinite loop and the STM32 was basically beeping at all time. I had to reset it by removing the power. The SW lib was checking for a bit to be set by the internal STM32 state machine and it never happened.

When I moved on onto another platform (IAR board and STM32 Eval. board), the exact same configuration provided by the EEPROM example worked like a charm. I was working on a project/schedule. I had to change platform.

Francis mentioned on the Forum recently that the I2C should be dealt with ST FW lib rev 2-0. Maybe they fixed something. I'm not sure yet as I'm just now starting to migrate to ST FW lib rev 2.

Sorry I cannot help.

Last edited by armaniake (2008-11-20 13:18:33)

Offline

 

# 6   2008-11-21 16:09:13 I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

Yes I understood they fixed several issues with in the STM32 libraries, above all around the I2C control.

Offline

 

# 7   2009-09-21 08:09:13 I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

czmiel
New member
Registered: 2009-08-19
Posts: 1

Re: I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

Hi all. I also have I2C problem. I've been using i2c2 polling (lib example), to communicate with eeprom chip.  Any timer (I've try timer2, and timer3 -> same result) interrupt killed i2c transmission. I'm afraid that, the only solutions (if you don't want to use i2c interrupts) is to write software I2C. I did it, and now everything works fine.

Offline

 

# 8   2009-09-21 08:37:06 I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

We had the same problem with I2C when accessing the Audio device in CircleOS. It seems that the problem disappeared with the latest STM32 libraries (used for CircleOS V3.8).

Offline

 

# 9   2009-09-21 14:04:47 I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

armaniake
Member
From: USA, Texas
Registered: 2007-08-22
Posts: 38

Re: I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

Hi Francis,

Did you have a chance to confirm the i2C works now with the latest OS Circle V3.8? It has been a while I switched HW platform but I'd be very excited to go back to the Primer I or II as everything I do is on I2C.

Thanks to share your experience.

Offline

 

# 10   2009-09-21 14:33:39 I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

armaniake
Member
From: USA, Texas
Registered: 2007-08-22
Posts: 38

Re: I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

Francis,

I just read this thread:

http://www.stm32circle.com/forum/viewtopic.php?id=739

It seems the I2C problem is still there. But what is strange is that I successfully back then took my code not running on the Primer I and it ran on an IAR platform and now an OLIMEX platform.

Could indeed the issue be more general? I was hoping this was fixed.

Offline

 

# 11   2009-09-21 17:57:25 I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: I2C2 and SPI2 usage - STM32 ERRATA (March 2008)

The problem encountered by Craig is now understood (and a workaround exists): the FSMC was the cause.
But we had another problem with CircleOS and interrupts while developing the audio features. We fixed it in moving the I2C management in the timer interrupt handler. But with CircleOS 3.8, we relocated the I2C management in the audio handler (its original place), and it works now. We didn't investigate further... The main difference we see is the version of the ST libraries.

Offline

 

Board footer