Problem with I2C on STM32F303CC

General discussion on mikroPascal PRO for ARM.
Post Reply
Author
Message
kahese
Posts: 10
Joined: 20 Jul 2013 12:54

Problem with I2C on STM32F303CC

#1 Post by kahese » 16 Jul 2020 18:51

Hello,
I'm having problems with I2C when connecting two devices to the same bus. The I2C_Write seems to always use the highest address used so far, no matter what it's given as first parameter. For example

I2C1_Write(0x38,@wert,1,END_MODE_STOP);
I2C1_Write(0x39,@wert,1,END_MODE_STOP);
I2C1_Write(0x38,@wert,1,END_MODE_STOP); // does not work, uses 0x39 as address instead

Same code runs fine on STM32F103C8.

I have attached a small example to reproduce the problem.

Any ideas?
Attachments
Div_Tests.mpas.zip
(848 Bytes) Downloaded 80 times

User avatar
jovana.medakovic
mikroElektronika team
Posts: 986
Joined: 18 Dec 2018 10:36

Re: Problem with I2C on STM32F303CC

#2 Post by jovana.medakovic » 06 Aug 2020 11:11

Hello,

I apologize for the delayed answer.

Could you provide me with more details?
Can you tell me which module (chip) you are using? Are you using some of our click boards?

Kind regards,
Jovana

Pelikan
Posts: 219
Joined: 22 Nov 2012 07:58

Re: Problem with I2C on STM32F303CC

#3 Post by Pelikan » 10 Aug 2020 22:09

moin KaHese,

in dem Prog

Procedure PCF_Reset;
var Help : byte;
Begin
Help := 0xff;
I2C1_Start();
I2C1_Write(0x38,@help,1,END_MODE_STOP);
end; //<-- das fehlt!

Die I2C Module von F103 und F303 sind etwas unterschiedlich.
Leider ist mein letztes Black-Pill mit F303CC von RoboDyn defekt. Neue dauern.

Hast Du die Möglicjkeit I2C zu loggen, wo es klemmt?

Mit Gruß
Peter

PS: Das Prog ist schon fast ulk, oder?

kahese
Posts: 10
Joined: 20 Jul 2013 12:54

Re: Problem with I2C on STM32F303CC

#4 Post by kahese » 11 Aug 2020 22:07

Dear Jovana,

I have connected two PCF 8574A modules.

Thanks and regards,
kahese

kahese
Posts: 10
Joined: 20 Jul 2013 12:54

Re: Problem with I2C on STM32F303CC

#5 Post by kahese » 13 Aug 2020 13:49

Hallo Peter,

Das mit dem end muss beim kopieren passiert sein. Habe das Programm ja compilieren können.
Das Programm ist nur zum testen des i2c Busses. Habe in einen anderen umfangreichen Programm festgestellt
Das es mit dem i2c bus Probleme gibt. Es ist folgendermaßen, es wird immer die zuletzt höchste Adresse weitere nutzt.
Habe mal ein Uhrenmodell mit A0 probiert da bleibt er immer bei so, auch wenn ich 38 benutze.
Habe alles mit einem logicanalyzer beobachtet..
Alles getestet mit dem Modul von RoboDyn. (STM32F303CC)
C
Lg Kalle

User avatar
stefan.filipovic
mikroElektronika team
Posts: 1135
Joined: 18 Dec 2018 10:30

Re: Problem with I2C on STM32F303CC

#6 Post by stefan.filipovic » 14 Aug 2020 13:17

Hi,

I've tested this on STM32F303RC which uses the same I2C library as STM32F303CC and I have not reproduced any issue.
I've used two EEPROM click boards (one at 0xA0 slave address, and the other at 0xA8) and Fusion for STM32 v8 with MCU CARD 3 for STM32 for the test.
Please find the test project in the attachment.
For further questions please write in English.

Kind regards,
Attachments
EEPROM click.zip
(205.06 KiB) Downloaded 90 times
Stefan Filipović

kahese
Posts: 10
Joined: 20 Jul 2013 12:54

Re: Problem with I2C on STM32F303CC

#7 Post by kahese » 19 Aug 2020 15:28

Hello,
My problem has not been solved yet, I use MikroPascal and not C.

I have attached the program and a logic analyzer protocol. Since the program runs on a STM32F103C8, I am thinking of a compiler error.

Kind regards,
Kalle
Attachments
Div_Tests.PDF
(338.4 KiB) Downloaded 80 times
Analyser.pdf
(222.05 KiB) Downloaded 77 times

User avatar
stefan.filipovic
mikroElektronika team
Posts: 1135
Joined: 18 Dec 2018 10:30

Re: Problem with I2C on STM32F303CC

#8 Post by stefan.filipovic » 21 Aug 2020 15:33

Hi Kalle,

Could you please try with the library from the attachment?
Just extract it to the following path:
c:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for ARM\Uses\ST M4\
Please let me know whether it solved the issue.

Kind regards,
Attachments
__Lib_I2C_12_3XX.zip
(9.8 KiB) Downloaded 72 times
Stefan Filipović

kahese
Posts: 10
Joined: 20 Jul 2013 12:54

Re: Problem with I2C on STM32F303CC

#9 Post by kahese » 22 Aug 2020 09:19

Hi, Stefan
Problem solved. thank you

Best regards
Kalle

Post Reply

Return to “mikroPascal PRO for ARM General”