Problem with i2c

General discussion on mikroBasic PRO for ARM.
Post Reply
Author
Message
joro800
Posts: 12
Joined: 19 Dec 2015 14:57

Problem with i2c

#1 Post by joro800 » 04 Nov 2018 22:51

Hi, i write i2c address scanner, stm32f303 disco stuck in loop. Maby wait for TC Transfer Complete flag, no way out anyway.?


Loop from .lst file

L__I2Cx_Write77:
L__I2Cx_Write46:
; i start address is: 8 (R2)
; I2C_BASE start address is: 4 (R1)
; ptr start address is: 12 (R3)
; count start address is: 0 (R0)
; count end address is: 0 (R0)
; ptrdata start address is: 28 (R7)
; ptrdata end address is: 28 (R7)
; I2C_BASE start address is: 4 (R1)
; I2C_BASE end address is: 4 (R1)
; i start address is: 8 (R2)
; i end address is: 8 (R2)
0x0358 0x681D LDR R5, [R3, #0]
0x035A 0xF3C50440 UBFX R4, R5, #1, #1
0x035E 0x2C00 CMP R4, #0
0x0360 0xD0FA BEQ L__I2Cx_Write77

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Problem with i2c

#2 Post by filip » 06 Nov 2018 11:19

Hi,

Can you please provide more details about your issue, like hardware setup and software example ?

Regards,
Filip.

joro800
Posts: 12
Joined: 19 Dec 2015 14:57

Re: Problem with i2c

#3 Post by joro800 » 06 Nov 2018 23:01

This is example, trying to break loop with NACK interrupt, but program returns again in loop, even when restarting i2c with PE bit.
Attachments
scani2c.rar
(103.74 KiB) Downloaded 101 times

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Problem with i2c

#4 Post by filip » 07 Nov 2018 17:06

Hi,

I'm not able to open the RAR file, could you check it please ?

Regards,
Filip.

joro800
Posts: 12
Joined: 19 Dec 2015 14:57

Re: Problem with i2c

#5 Post by joro800 » 07 Nov 2018 21:28

:?
Attachments
scani2c.zip
(697.68 KiB) Downloaded 101 times

joro800
Posts: 12
Joined: 19 Dec 2015 14:57

Re: Problem with i2c

#6 Post by joro800 » 15 Nov 2018 21:52

Hi Filip. Do you check the file's?

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: Problem with i2c

#7 Post by petar.suknjaja » 22 Nov 2018 16:14

Hi,

I've tried the simple EEPROM example from the compiler, which uses the Hardware I2C library, on the EasyMX PRO V7 for STM32 and it runs without problems.

I would suggest you to try a different approach in creating the I2C scanner, using the integrated routines such as I2Cn_Is_Idle.

Consult the Help Section regarding the I2C.

Kind regards,

Petar

Post Reply

Return to “mikroBasic PRO for ARM General”