ASF4 (Atmel Start) I2C (m_async) problem: works at 12MHz, not at 120MHz

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm working with Atmel Start code on SAME54, having an issue with the I2C driver.

 

If I make a project using the master "sync" I2C driver, that works with default clocks at 12MHz.

It also works if I set the CPU clock up to 120MHz (I2C GCLK still at 12MHz).

 

If I make a project using the master "async" I2C driver (not the RTOS one), that also works with default clock at 12MHz.

 

But if I set the CPU clock up to 120MHz (again still using same 12MHz GCLK for I2C), I start getting calls to the error handler.

The code is -5 which is a bus error.

 

I'm now starting to study with a scope, but wondering if anyone has seen this one?

pondzone

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Setting the peripheral clock for the I2C to the 120MHz clock seems to fix this.

 

For uarts and i2c ports, how do you pick what clock speed is best for the peripheral?

pondzone

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The standard I2C bus speed is 100kHz

Some devices work at fast mode 400kHz

A few devices work at full mode 1MHz

Very few devices work high speed mode 3.2MHz

 

There is no minimum speed for I2C.   The slowest device on the bus determines the maximum speed you can use safely.

 

The "high speed mode" requires some care with bus layout and MCU hardware.

Quite honestly,   there is little point in attempting to run I2C devices at silly speeds unless there is a lot of traffic e.g. OLED displays.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As David said, unless you have a really good reason to, I wouldn't bother with I2C faster than 100khz.  The SAMG55 can support up to 400khz in master mode, but can only hit the high speed numbers as a slave.