AdaCore / AdaCore/Ada_Drivers_Library

I2C w/16bit mem addr

Open
#173 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Ada
Stars
286
Forks
165
PR merge metrics
No merged PRs in 30d

Description

I see a punch through issue wrt successive .DR.DR writes for a 16bit mem addr.

In stm32-i2c.adb:621 adding this wait after the end case seems to clean up the issue. Should be benign for 8bit mem addr also. I have not looked at the other 16bit handlers but I assume they will also need this treatment. Certainly read needs it. My sensor is an ST VL6180X Range and ALS sensor. It uses 16bit addresses. On the logic analyzer I do see the address being stepped on by the following read command thereby culling the DR of the LSB for the parts mem addr.

  Wait_Flag (This, Tx_Data_Register_Empty, False, Timeout, Status);

  if Status /= HAL.I2C.Ok then
 return;
  end if;
  
  --  We now need to reset and send the slave address in read mode
  This.Periph.CR1.START := True;

  Wait_Flag (This, Start_Bit, False, Timeout, Status);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in stm32-i2c.adb around line 621 and inspect the successive DR writes and the other 16-bit handlers, including reads. Use the reported VL6180X transaction and logic-analyzer behavior as the reproduction case. Done means the 16-bit memory address is preserved through the following read command while 8-bit addressing remains unaffected.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.