AnsweredAssumed Answered

I2C stops working if Segger or CMSIS-DAP is used

Question asked by Jan Rychter on Nov 6, 2015
Latest reply on Dec 28, 2015 by Jorge_Gonzalez

In the process of bringing up my board based on a K20, I encountered problems with I2C. I would initialize I2C and load the first address byte, but then I'd get no interrupts, ever.

 

This was strange, because the I2C code is my own (https://github.com/jwr/kinetis_i2c/tree/cmsis), and I used it before with no problems.

 

I'm using KDS 3.0.0 (updated) under Linux, with Segger J-Link to connect to my board.

 

So I started looking at my recent code changes, clocking, all kinds of possible problems. I also took out a FRDM-K20D50M board (Segger debug firmware) just to be sure that I can reproduce the problem in a pristine environment. The problem was the same on the FRDM board.

 

I brought up an old virtual machine with CodeWarrior 5.5 and some old I2C project that used to work — same result, none of them worked. I was sure they worked before. This was getting weird.

 

In an act of desperation, I decided to reflash the OpenSDA part of the FRDM-K20D50M, just to see if using the P&E debug firmware would give me a better view of the registers. This took quite a while, because I had an old 1.09 bootloader, which can't be updated using any modern OS. Luckily I had an ancient VMware snapshot with Windows XP!

 

And suddenly things started working again.

 

I did some more testing and I don't understand the results. Here's a breakdown:

 

  • my board + Segger J-Link -> I2C does not work
  • FRDM + Segger firmware -> I2C does not work
  • FRDM + P&E firmware -> I2C works
  • FRDM + bootloader only (booted in firmware update mode) -> I2C works
  • FRDM + CMSIS-DAP firmware -> I2C does not work

 

On the FRDM board, it seems that just the presence of Segger or CMSIS-DAP firmware prevents I2C from working. It doesn't matter if I'm debugging — just hitting RESET with P&E firmware present produces an I2C transaction, and with Segger or CMSIS-DAP firmware present it does not.

 

When stepping through the code, everything looks fine up to a certain point. I2C module is initialized, interrupts get enabled, master mode is set and a start condition generated. But then I write to the D register and... nothing happens. I get no interrupts. A bus sniffer shows only a start condition being generated.

 

The firmware versions I used for testing are: JLink_OpenSDA_2015-10-13.sda, CMSIS-DAP_OpenSDA.S19, MSD-DEBUG-FRDM-K20D50M_Pemicro_v115.SDA.

 

Frankly, I have no idea what to make of this, which is why I'm asking for help. Leaving aside my board for now, on the FRDM — I can't understand how just the presence of certain OpenSDA debug firmware could influence how my code works.

 

Any ideas?

Outcomes