ATSAMV71 Xplained Ultra I2C peripheral Issue

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

 

Issue: I2C_1 and I2C_2 peripherals do not work when using the I2C_Master_Sync or the I2C_Master_RTOS_Beta driver. I2C_0 do work for both these drivers. When the output of peripherals is viewed on an oscilloscope no activity can be seen on DATA or CLK, they are just sitting high at 3.3v. When I2C_0 is viewed correct IC2 coms can be seen. 

 

Most investigation has been done using the I2C_Master_RTOS_Beta driver. On I2C_1 and I2C_2, when the data is written into the TWIHS_THR register the TXRDY register does not go high. 

 

Status Register values for I2C_0 (working) and I2C_1 (not working) After a call to _i2c_m_async_write. 

 

    0x0000000c (I2C_0)
        TXCOMP Transmission Completed     = 0
        RXRDY Receive Holding Register     = 0
        TXRDY Transmit Holding Register = 1
        VREAD Slave Read                 = 1

        SCL SCL Line Value                 = 0
        SDA SDA Line Value                 = 0

 

    0x03000008 (I2C_1)
        TXCOMP Transmission Completed     = 0
        RXRDY Receive Holding Register     = 0
        TXRDY Transmit Holding Register = 0
        VREAD Slave Read                 = 1

        SCL SCL Line Value                 = 1
        SDA SDA Line Value                 = 1

 

This results in the driver waiting for a semaphore indefinitely on I2C_1. 

 

I have another project setup using the sync driver and this shows the same results on I2C_1 and I2C_2 with the driver constantly waiting for TXRDY or a NACK. I2C_0 is correctly reading temps from a sensor.

 

The datasheet says that TXRDY goes high when the data is transferred to the internal shifter, so is it possible this is not occurring? 

 

I have looked at the PMC controller to check the correct peripheral clocks are enabled and as far as I can tell they are. 

 

Any help would be much appreciated and I am happy to provide any more info. 

Thanks. 

 

 

Last Edited: Mon. Nov 22, 2021 - 07:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's not completely obvious for me where you in each case connect to the I2C signals. TWIHS0 I expect is on PA03 and PA04 which is on the I2C pins on both EXT1 and EXT2, is this what you have as I2C_0 in Atmel start maybe?

/Lars

 

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

I2C_0 is on PA03 and PA04 which I connect to through pins 11 and 12 on EXT1 or SCL and SDA. I2C_1 I can connect to through PB05 on coresight 20 connector Pin 6 and PB04 EXT2 Pin 14. I2C_2 on PD28 (D21) and PD27 (D20). 

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

Update: I have managed to solve the issue with I2C_2, unfortunately I2C_1 is still not working. Both peripherals were missing the corresponding _i2cm_sync_cfg struct, so a NULL ptr was being returned and due to a lack of checks it continued to be used. This meant that the values going into the registers during initialization were incorrect. 

 

Seems like that part of the code was not generated by Atmel start for some reason. 

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

Issue solved. Pull-ups have to be explicitly enabled for I2C_1 unlike I2C_0 and IC2_2 due to them having different default states.