Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I2C w/16bit mem addr #173

Open
morbos opened this issue Mar 7, 2017 · 2 comments
Open

I2C w/16bit mem addr #173

morbos opened this issue Mar 7, 2017 · 2 comments
Labels

Comments

@morbos
Copy link
Contributor

morbos commented Mar 7, 2017

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);
@Fabien-Chouteau
Copy link
Member

Hi @morbos ,

It's possible that we never tested the 16bit mem address mode, so I would not be surprised to see a problem here.

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.

It looks OK. Can you send a pull request with that change? If it doesn't break the other I2C mode we will be happy to have it.

My sensor is an ST VL6180X Range and ALS sensor.

Interesting, my colleague @lambourg is working on the VL53l0X. Have a look at this branch: https://github.com/AdaCore/Ada_Drivers_Library/tree/vl53l0x

Thanks,

@morbos
Copy link
Contributor Author

morbos commented Mar 10, 2017

Hi Fabien, @lambourg's work is very helpful indeed. We have the same 4 char display on the shield. The vl5310x needs only an 8bit addr. One beef I have with the vl6180x is there are 30 undocumented writes (ex: write (this.Port, 16#0097#, 16#fd#); etc) to get the device to do useful work. After Pat updated the BNO055 example to use the generic, I wanted to try my hand at a sensor as a generic, thus the vl6180x (via a shield) on an F4 Nucleo board (STM32F401RE).

Hedley

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants