Difference: I2CEEProm (1 vs. 6)

Revision 62017-11-29 - uli

Line: 1 to 1
 
META TOPICPARENT name="CourseExercises"

Exercise 15: EEPROM and Driver Access

Goal:

Line: 40 to 40
  The pdf of the examination exercises are found here:
Changed:
<
<
https://iotworkshop.africa/pub/Embedded_Systems/I2CEEProm/exam.pdf
>
>
https://iotworkshop.africa/pub/Embedded_Systems/I2CEEProm/csc_exam.pdf
  It is possible to access the I2C driver directly and it was my intention to show you how to do this. Unfortunately we did not make it up a level where we can understand how a device driver works. The following exercises it there not part of the examination exercises!

Exercise 4: Write an access library

Line: 63 to 63
 
META FILEATTACHMENT attachment="rtc.png" attr="" comment="" date="1508954803" name="rtc.png" path="rtc.png" size="1144945" user="uli" version="1"
META FILEATTACHMENT attachment="session_14.odt" attr="" comment="" date="1511282959" name="session_14.odt" path="session_14.odt" size="1169933" user="uli" version="1"
Changed:
<
<
META FILEATTACHMENT attachment="exam.pdf" attr="" comment="" date="1511461856" name="exam.pdf" path="exam.pdf" size="1720132" user="uli" version="1"
>
>
META FILEATTACHMENT attachment="csc_exam.pdf" attr="" comment="" date="1511971402" name="csc_exam.pdf" path="csc_exam.pdf" size="1733296" user="uli" version="1"

Revision 52017-11-23 - uli

Line: 1 to 1
 
META TOPICPARENT name="CourseExercises"

Exercise 15: EEPROM and Driver Access

Goal:

Line: 38 to 38
  Prepare a buffer with some data to be written to the EEPROM. Use your previous program to read these data back. Power down the Raspberry Pi, wait a minute and then switch it back on again. Verify that you can still read back the data.
Added:
>
>
The pdf of the examination exercises are found here:

https://iotworkshop.africa/pub/Embedded_Systems/I2CEEProm/exam.pdf

  It is possible to access the I2C driver directly and it was my intention to show you how to do this. Unfortunately we did not make it up a level where we can understand how a device driver works. The following exercises it there not part of the examination exercises!

Exercise 4: Write an access library

Line: 59 to 63
 
META FILEATTACHMENT attachment="rtc.png" attr="" comment="" date="1508954803" name="rtc.png" path="rtc.png" size="1144945" user="uli" version="1"
META FILEATTACHMENT attachment="session_14.odt" attr="" comment="" date="1511282959" name="session_14.odt" path="session_14.odt" size="1169933" user="uli" version="1"
Added:
>
>
META FILEATTACHMENT attachment="exam.pdf" attr="" comment="" date="1511461856" name="exam.pdf" path="exam.pdf" size="1720132" user="uli" version="1"

Revision 42017-11-21 - uli

Line: 1 to 1
 
META TOPICPARENT name="CourseExercises"

Exercise 15: EEPROM and Driver Access

Goal:

Line: 7 to 7
  The at24c32 EEPROM is mounted together with the DS1307 RTC on the Tiny RTC module (chip on the right). The Tiny RTC module therefore responds to 2 I2C addresses. You find these 2 addresses with the i2cdetect command and you can figure out from the data sheets which of the addresses corresponds to which chip.
Added:
>
>
The data sheet for the at24c32 can be found here:

http://www.atmel.com/Images/doc0336.pdf

 rtc.png
Added:
>
>

Examination exercises

For the examination please solve exercise 1-3 of this exercise list. Exercise 4 is not part of the examination!

For all three exercises, write

  • the C code
  • a Makefile
  • a shell script that sets up the LD_LIBRARY_PATH to include /opt/ucc/lib, such that the at24c32 library can be found (not necessary of course if you do not use the at24c32 library)
  • a short description on how you designed the program and what the individual steps are that the program takes to solve the problem.
 

Exercise 1: Read the EEPROM

The at24c32 is a 32 kBit device and can therefore store a total of 4096 bytes (4096 * 8 = 32 kBit). Like the DAC it is an I2C device. To make things easier for you, again a library is supplied.

Line: 17 to 30
  https://dcsit.twiki.ucc.edu.gh/html/libDoc/at24c32
Changed:
<
<
This one is an exercise for detectives: There is a secret message hidden in the EEPROM and your job is to uncover the mystery. So… Sherlock Holmes and Dr. Watson: show your talents and find out the contents of the message.

Exercise 2: Write the EEPROM

>
>
This one is an exercise for detectives: There is a secret message hidden in the EEPROM and your job is to uncover the mystery. So… Sherlock Holmes and Dr. Watson: show your talents and find out the contents of the message. Write a program called readEnigma reading the EEPROM and printing its content in hex (%x) and as characters (%c).

Exercise 2: Re-write the program without using the library

Since there are only very few library calls it is also possible to access the EEPROM through pigpio calls avoiding my library all together. Make sure you get the same result as in the first exercise.

Exercise 3: Write the EEPROM

  Prepare a buffer with some data to be written to the EEPROM. Use your previous program to read these data back. Power down the Raspberry Pi, wait a minute and then switch it back on again. Verify that you can still read back the data.
Changed:
<
<

Exercise 3: Write an access library

>
>
It is possible to access the I2C driver directly and it was my intention to show you how to do this. Unfortunately we did not make it up a level where we can understand how a device driver works. The following exercises it there not part of the examination exercises!

Exercise 4: Write an access library

  The full description on how to access I2C devices through the driver directly is found here.
Line: 40 to 58
 
<--/commentPlugin-->

META FILEATTACHMENT attachment="rtc.png" attr="" comment="" date="1508954803" name="rtc.png" path="rtc.png" size="1144945" user="uli" version="1"
Added:
>
>
META FILEATTACHMENT attachment="session_14.odt" attr="" comment="" date="1511282959" name="session_14.odt" path="session_14.odt" size="1169933" user="uli" version="1"

Revision 32017-11-08 - uli

Line: 1 to 1
 
META TOPICPARENT name="CourseExercises"

Exercise 15: EEPROM and Driver Access

Goal:

Line: 15 to 15
  The documentation of the library is again generated from the source code and can be found at the URL:
Changed:
<
<
file:///opt/ucc/exercises/solutions/eeprom/html/index.html
>
>
https://dcsit.twiki.ucc.edu.gh/html/libDoc/at24c32
  This one is an exercise for detectives: There is a secret message hidden in the EEPROM and your job is to uncover the mystery. So… Sherlock Holmes and Dr. Watson: show your talents and find out the contents of the message.

Exercise 2: Write the EEPROM

Revision 22017-10-25 - uli

Line: 1 to 1
 
META TOPICPARENT name="CourseExercises"

Exercise 15: EEPROM and Driver Access

Goal:

The goal of this exercise is twofold: First we will learn about an EEPROM, a Electrically Erasable Read Only Memory. These devices are often used in instruments to store calibration values or configuration parameters. EEPROMs can usually be read byte by byte but can be erased and written only in blocks.

Changed:
<
<
The at24c32 is a 32kbit (4 kbyte) EEPROM with an I2C interface.
>
>
The at24c32 EEPROM is mounted together with the DS1307 RTC on the Tiny RTC module (chip on the right). The Tiny RTC module therefore responds to 2 I2C addresses. You find these 2 addresses with the i2cdetect command and you can figure out from the data sheets which of the addresses corresponds to which chip.

rtc.png

 
Deleted:
<
<
This time however we will not use the I2C access functions in the pigpio library but access the i2c driver directly. You need to
  • open the device (/dev/i2c-1)

  • find out which functions the drivers supports (ioctl I2C_FUNCS)

  • block read the data

  • close the device

The full description on how to access I2C devices through the driver directly is found here.
 

Exercise 1: Read the EEPROM

Added:
>
>
The at24c32 is a 32 kBit device and can therefore store a total of 4096 bytes (4096 * 8 = 32 kBit). Like the DAC it is an I2C device. To make things easier for you, again a library is supplied.

The documentation of the library is again generated from the source code and can be found at the URL:

file:///opt/ucc/exercises/solutions/eeprom/html/index.html

 This one is an exercise for detectives: There is a secret message hidden in the EEPROM and your job is to uncover the mystery. So… Sherlock Holmes and Dr. Watson: show your talents and find out the contents of the message.

Exercise 2: Write the EEPROM

Prepare a buffer with some data to be written to the EEPROM. Use your previous program to read these data back. Power down the Raspberry Pi, wait a minute and then switch it back on again. Verify that you can still read back the data.

Exercise 3: Write an access library

Added:
>
>
The full description on how to access I2C devices through the driver directly is found here.
 Separate out the open, close, read, write … functions into individual files. Rewrite your programs such that you call these generic functions, which can be re-used by other programs.

These are the functions that should be available:

Line: 34 to 38
 

Comments

<--/commentPlugin-->
\ No newline at end of file
Added:
>
>
META FILEATTACHMENT attachment="rtc.png" attr="" comment="" date="1508954803" name="rtc.png" path="rtc.png" size="1144945" user="uli" version="1"

Revision 12017-08-21 - uli

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="CourseExercises"

Exercise 15: EEPROM and Driver Access

Goal:

The goal of this exercise is twofold: First we will learn about an EEPROM, a Electrically Erasable Read Only Memory. These devices are often used in instruments to store calibration values or configuration parameters. EEPROMs can usually be read byte by byte but can be erased and written only in blocks.

The at24c32 is a 32kbit (4 kbyte) EEPROM with an I2C interface.

This time however we will not use the I2C access functions in the pigpio library but access the i2c driver directly. You need to

  • open the device (/dev/i2c-1)

  • find out which functions the drivers supports (ioctl I2C_FUNCS)

  • block read the data

  • close the device

The full description on how to access I2C devices through the driver directly is found here.

Exercise 1: Read the EEPROM

This one is an exercise for detectives: There is a secret message hidden in the EEPROM and your job is to uncover the mystery. So… Sherlock Holmes and Dr. Watson: show your talents and find out the contents of the message.

Exercise 2: Write the EEPROM

Prepare a buffer with some data to be written to the EEPROM. Use your previous program to read these data back. Power down the Raspberry Pi, wait a minute and then switch it back on again. Verify that you can still read back the data.

Exercise 3: Write an access library

Separate out the open, close, read, write … functions into individual files. Rewrite your programs such that you call these generic functions, which can be re-used by other programs.

These are the functions that should be available:

  • at24c32Open

  • at24c32Close

  • at24c32Read

  • at24c32Write

  • at24c32Debug (switching debugging information on or off)

-- Uli Raich - 2017-08-21

Comments

<--/commentPlugin-->
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback