STM32F103Z, problems with FSMC and i2c

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

mukululul
Posts: 27
Joined: Thu Nov 28, 2013 4:22 pm

STM32F103Z, problems with FSMC and i2c

Post by mukululul »

Hello,
I am using a STM32F103ZET with a ILI9320 chibios and ugfx.
My i2c devices work fine without the display. Once I initialize the LCD i2c stops working, the LCD works as expected.
For i2c I am using PB6 and PB7 with I2C1.
For the ILI9320 I am using FSMC.

I could not find any HW restrictions in the specs.
Again I looked at the block diagram and recognized that FSMC is even using a different bus, not the AHB.

Anybody any ideas what the problem can be here?

Regards
Michael
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32F103Z, problems with FSMC and i2c

Post by Giovanni »

Hi,

Is there any DMA conflict?

Giovanni
mukululul
Posts: 27
Joined: Thu Nov 28, 2013 4:22 pm

Re: STM32F103Z, problems with FSMC and i2c

Post by mukululul »

Hi,
how can I find this out? Any support from chibios or is the only way going through the specs?

Greetings
Michael
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32F103Z, problems with FSMC and i2c

Post by Giovanni »

Hi,

The DMAs used by the ChibiOS drivers are specified in the mcuconf.h of your application. You cannot have at the same time two drivers using the same DMA in active state (after xxxStart()).

I don't know if the LCD uses any DMA, that could explain it.

Giovanni
mukululul
Posts: 27
Joined: Thu Nov 28, 2013 4:22 pm

Re: STM32F103Z, problems with FSMC and i2c

Post by mukululul »

Hi Giovanni,
thank you for your fast replies :-)

in mcuconf.h I see these defines
#define STM32_I2C_I2C1_DMA_PRIORITY 1

Is that the DMA define you mentioned?

Can I simply change it to any free or is it restricted depending on Device?

Thanks
Michael
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32F103Z, problems with FSMC and i2c

Post by Giovanni »

Ah sorry, you are using an F1 device whose DMA channels are fixed, you have to consult the channels mapping table in the Reference Manual, see the DMA section.

In some newer devices DMA channels can be remapped.

Giovanni
alexblack
Posts: 277
Joined: Mon Sep 24, 2012 3:52 pm
Been thanked: 33 times

Re: STM32F103Z, problems with FSMC and i2c

Post by alexblack »

Hi, I have project on STM32F103ZET which used FSMC, and I2C1 - all works fine, but I REMAP I2C1 pins from standard locations (AFIO_MAPR_I2C1_REMAP option active)! May be this is your problem.
mukululul
Posts: 27
Joined: Thu Nov 28, 2013 4:22 pm

Re: STM32F103Z, problems with FSMC and i2c

Post by mukululul »

Hi Alex and Giovanni,

Giovanni for your reply i will try this.

Alex how did you do this?

Like this?
AFIO->MAPR |= AFIO_MAPR_I2C1_REMAP

Btw, I have also CAN running and I see the same there. Once FSMC runs no more CAN or I2C.

Thanks
Michael
mukululul
Posts: 27
Joined: Thu Nov 28, 2013 4:22 pm

Re: STM32F103Z, problems with FSMC and i2c

Post by mukululul »

Hi Alex,
as far as I understand it remapping the I2C1 will reassign the physical pins from PB6/7 to PB8/9. Since I am using a Developmentboard and the CANtx is wired to PB8/9 I cannot change.
Thanks
Michael
mukululul
Posts: 27
Joined: Thu Nov 28, 2013 4:22 pm

Re: STM32F103Z, problems with FSMC and i2c

Post by mukululul »

I changed STM32_I2C_I2C1_DMA_PRIORITY from 1 to 3, still the same.

Something I observed is that a reset via jtag will not reset the i2c problem. Once I used the LCD and I flash the version without LCD init I need a additional hardwarereset in order to make i2c work again.
That means some settings in the chip are changed which are not reset via a jtag reset.

Any more Ideas?

Thanks for your help.

Michael
Post Reply