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

Adding I2C functionality to the FX2 device. (Tested with a 24C256 EEPROM) #22

Open
wants to merge 1 commit into
base: linux-descriptors
Choose a base branch
from

Conversation

RacingTornado
Copy link

This commit adds I2C functionality to the eeprom. The same steps are applicable to this pull request to make and build use the following steps:
To run this first clone the repository, then cd to the fx2lib directory and checkout this particular branch.
After this run 2 commands:
git submodule init
git submodule update
make
After this , navigate to the examples/i2c_bitbang directory and execute the following commands:
make
Now push the FX2 device inside the USB port(remove any udev rules you may have set up for Cypresse's VID and PID) and run
make fx2_download
After this open minicom
sudo minicom -H -w name_of_configuration
You should see the data which is read from the EEPROM displayed on your console. Make sure the UART0 pins are connected to the appropriate GPIO's on the FX2.

A couple of things to take care are that the I2C is in non-blocking mode. So often the same data is printed(that is previous data) if new data has not arrived. By using a logic analyzer the I2C can be confirmed to work. Otherwise we would need to busy wait in the loop which removes any benefit we may get from using queues.

…t consists of a soft i2c core along with a shift register and an examples directory to show its usage.
I2C BLOCK BITBANG
*********************************/
//Called with number of retries
i2c_init(3);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retries 3 times.

@mithro
Copy link
Owner

mithro commented Jul 11, 2016

This needs a huge amount of work.

  • You fail on consistency, formatting, etc.
  • The queue structure you have created does a huge amount of work which seems pointless.
  • You are confusing low level details with high level details.
  • The I2C state machine is really hard to follow.
  • You don't deal with things like 8bit verse 16bit I2C addresses.

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

Successfully merging this pull request may close these issues.

3 participants