cancel
Showing results for 
Search instead for 
Did you mean: 

FM0+, FM3 & FM4 MCU

PaWa_3505426
New Contributor II

Hi, i've a very strange problem.

The I2C part of my software only works, when the debugger is connected. (It fails inside the PDL Mfs_I2c_GenerateStart() function in mfs.c)

If i download the debug version of the code, disconnect the debugger and power off / on the board, the software is running but I2C is not working.

If i download the release version the same thing happens.

But if i download the debug version and leave the debugger attached and the debug session running, the software works perfectly fine, as long as it can reconnect to the debugger when i power it on.

I already checked the reset pin, but that isn't the problem. What was really strange too is, that the clock settings where different when the debugger was connected than when it wasnt. I now set the CLOCK_SETUP define to CLOCK_SETTING_NONE and setup my clock with the PDL library myself and it's now running at 160 Mhz all the time.

What could cause I2C to fail, if the debugger is not connected? I guess it has something to do with a delay or a clock beeing different, but i can't find anything.

0 Likes
1 Solution
PaWa_3505426
New Contributor II

Hi

I actually found the problem after way to mutch time.

When the debugging session is active, the debugger adds some delay to the start of the software.

This is really minor but it was enought, that the I2C didn't work without that extra delay. (The Bus-Busy flag was always set)

Now i added a delay in software between the start of the I2C initialization and the first data transmission and it works perfectly fine.

Device in use: MB9BF164KPMC

View solution in original post

0 Likes
2 Replies
BragadeeshV
Moderator
Moderator

Hello Patrick,

Could you please mention the device you are using?

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes
PaWa_3505426
New Contributor II

Hi

I actually found the problem after way to mutch time.

When the debugging session is active, the debugger adds some delay to the start of the software.

This is really minor but it was enought, that the I2C didn't work without that extra delay. (The Bus-Busy flag was always set)

Now i added a delay in software between the start of the I2C initialization and the first data transmission and it works perfectly fine.

Device in use: MB9BF164KPMC

View solution in original post

0 Likes
Top labels