Page 1 of 3

STM32F103Z, problems with FSMC and i2c

Posted: Thu Nov 28, 2013 4:31 pm
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

Re: STM32F103Z, problems with FSMC and i2c

Posted: Thu Nov 28, 2013 5:07 pm
by Giovanni
Hi,

Is there any DMA conflict?

Giovanni

Re: STM32F103Z, problems with FSMC and i2c

Posted: Thu Nov 28, 2013 5:17 pm
by mukululul
Hi,
how can I find this out? Any support from chibios or is the only way going through the specs?

Greetings
Michael

Re: STM32F103Z, problems with FSMC and i2c

Posted: Thu Nov 28, 2013 6:03 pm
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

Re: STM32F103Z, problems with FSMC and i2c

Posted: Thu Nov 28, 2013 6:26 pm
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

Re: STM32F103Z, problems with FSMC and i2c

Posted: Thu Nov 28, 2013 6:34 pm
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

Re: STM32F103Z, problems with FSMC and i2c

Posted: Thu Nov 28, 2013 6:59 pm
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.

Re: STM32F103Z, problems with FSMC and i2c

Posted: Thu Nov 28, 2013 7:41 pm
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

Re: STM32F103Z, problems with FSMC and i2c

Posted: Thu Nov 28, 2013 7:53 pm
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

Re: STM32F103Z, problems with FSMC and i2c

Posted: Thu Nov 28, 2013 8:16 pm
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