Go to Post Haters gonna hate, Cheesers gonna cake. - Ryan Dognaux [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 28-01-2017, 05:51
DavidOrser DavidOrser is offline
Registered User
FRC #2987 (Rogue Robotics)
Team Role: Mentor
 
Join Date: Feb 2016
Rookie Year: 2014
Location: Minneapolis, MN
Posts: 6
DavidOrser will become famous soon enough
I2C Class Issues

Disclaimer: I'm aware that the I2C class states "This class is intended to be used by sensor (and other I2C device) drivers. It probably should not be used directly."

We have been playing with the I2C class a fair amount lately and I wanted to share those results with others and see if anyone else can confirm some of these odd behaviors. I'm not sure if its just the devices we are using or if several of the class methods are really broken.

We have the Pixy plugged into the kOnBoard I2C port. We have the Logic 4 as a scope/logic analyser.

Class functions/members/methods:
AddressOnly() // Doesn't appear to work at all
Transaction() // Write portion might work, but it reads back the same value all the time
Read() // reads back the same value all the time

ReadOnly() // works fine
WriteBulk() // Works fine
Write() // Works fine

It appears as if the Read() and Transaction() always return the first value returned by the device. I can confirm this is the pattern on the bus, due to the logic analyser. So the problem has to be either the SDA pin is being driven by the RoboRio or somehow the Start/Stop/ReStart/ACK sequence is not being handled correctly and the bus gets stuck in some way.

Anyone have experience with this type of behavior? Any other thoughts?

We were able to successfully read and write to a Lidar Lite v3 with the following code snippet:
Code:
      i2c_Lidar->Write(0x00, 0x00);
      Wait(.025);
      i2c_Lidar->Write(0x00, 0x04);
      Wait(.005);

      djoSendData[0] = 0x01;  // Bulk Write Based Read_Only for a single register Read of 0x01 (status)
      i2c_Lidar->WriteBulk(djoSendData,1);
      i2c_Lidar->ReadOnly(1,LidarMassData);
      Wait(0.001);

      djoSendData[0] = 0x8F;  // Bulk Write Based Read_Only for a two register Read of 0x8F (distance)
      i2c_Lidar->WriteBulk(djoSendData,1);
      i2c_Lidar->ReadOnly(2,LidarMassData);
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 04:17.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi