i2cEepromDemo
This example (i2cEepromDemo directory) demonstrates the usage of the I2C driver to establish communication with the on-board EEPROM device, specifically the AT24C01 that is used in the Trion T120F324 and T120F576 development kit. The UART console serves as an interactive terminal that allows you to select the available operations, specify the address and number of bytes to read/write, and provide the data to be written.
This example shows you on the interaction and configuration with the onboard EEPROM using the I2C driver that facilitates the data transfer and its manipulation through the UART console.
T120F324/T120F576 Dev Kit on-board EEPROM, AT24C01 i2c-demo !
Please make sure you are using the T120F324/T120F576 Dev Kit to run this demo!
Please choose the feature you would like to run (key in the selection and press enter):
1: Write a byte to EEPROM
2: Read a byte from EEPROM
3: Current Address Read (Last accessed address incremented by 1)
4: Read multiple byte from EEPROM
5: Write multiple byte to EEPROM
- Type
1on the console and press enter. - Enter the desired address in hexadecimal format. For example, if you want to
write to the address '0000', enter
0000and press enter. - If you enter an invalid address, the message "invalid address input" is displayed. Re-enter a valid address in hexadecimal format.
- Upon entering a valid address, you will be prompted to enter a byte of data to
be written into the EEPROM. For instance, if you want to write the hexadecimal
value of '55', type the value
55and press enter.
By following these steps, you will be able to write a byte of data to the EEPROM using the provided interface. You must follow the instructions and input the required values accurately to ensure successful data writing.
Please choose the feature you would like to run (Key in the selection and press Enter):
1: Write a byte to EEPROM
2: Read a byte from EEPROM
3: Current Address Read (Last accessed address incremented by 1)
4: Read multiple byte from EEPROM
5: Write multiple byte to EEPROM
1
Write operation selected, please enter the location in hex with 16-bit size
00000
Invalid address input, please key in correct address. I.e. 1024 which is in hexadecimal.
0000
Valid address input, please wait while the operation process
address in hex = 0x0000000000000000
Enter the byte of data to write into the eeprom in hexadecimal
55
Inputted number of byte of data to write
Single Byte Write operation started
Write operation successful
- Type
2on the console and press enter to select the read operation. - Enter the desired address in hexadecimal format. For example, if you want to
read from the address '0000', enter
0000and press enter.
The system reads the data from the specified address in the EEPROM and prints out the read-back data on the console.
Please choose the feature you would like to run (Key in the selection and press Enter):
1: Write a byte to EEPROM
2: Read a byte from EEPROM
3: Current Address Read (Last accessed address incremented by 1)
4: Read multiple byte from EEPROM
5: Write multiple byte to EEPROM
2
Read operation selected, please enter the location in hex with 16-bit size
0000
Valid address input, please wait while the operation process
address in hex = 0x0000000000000000
Read operation started
Read operation successful.
Read data = 00000055
- Type
5on the console and press enter to select the multiple bytes to write operation. - Enter the desired address in hexadecimal format. For example, type
0000if you want to start writing at address '0000', and press enter. - Enter the number of bytes of data you want to write into the EEPROM, in
hexadecimal format. For example, type
05if you want to write 5 bytes and press enter. - Enter the bytes of data to be written into the EEPROM, in hexadecimal format.
The data must not have any spacing in between and in an ascending pattern. For
example, type
0102030405to write the bytes 01, 02, 03, 04, and 05, and press enter.
By following these steps, you will be able to write multiple bytes of data to the EEPROM using the provided interface. You must enter the correct values in hexadecimal format in an ascending order data pattern without spacing between the bytes.
Please choose the feature you would like to run (Key in the selection and press Enter):
1: Write a byte to EEPROM
2: Read a byte from EEPROM
3: Current Address Read (Last accessed address incremented by 1)
4: Read multiple byte from EEPROM
5: Write multiple byte to EEPROM
5
Write Multi-Byte operation selected, please enter the location in hex with 16-bit size
0000
Valid address input, please wait while the operation process
address in hex = 0x0000000000000000
Enter the number of byte of data to write/read into/from the eeprom in hexadecimal (Maximum: 255 Bytes)
05
Number of bytes: 00000005
Enter the byte of data to write intothe eeprom in hexadecimal (without spacing in between)
0102030405
Inputted number of byte of data to write
Multi Byte Write operation started
Write operation successful
- Type
4on the console and press enter to select the multiple bytes read operation. - Enter the desired address in hexadecimal format. For example, if you want to
start reading from the address '0000', enter
0000and press enter. - Enter the number of bytes of data to be read from the EEPROM, in hexadecimal
format. For example, type
5if you want to read 5 bytes, and press enter.
The system reads the specified number of bytes of data from the EEPROM, starting from the specified address, and prints out the read-back data on the console.
By following these steps, you will be able to read multiple bytes of data from the EEPROM using the provided interface. You must enter the correct operation code of the desired starting address and the number of bytes to read, in hexadecimal format, to retrieve accurate data from the EEPROM.
Please choose the feature you would like to run (Key in the selection and press Enter):
1: Write a byte to EEPROM
2: Read a byte from EEPROM
3: Current Address Read (Last accessed address incremented by 1)
4: Read multiple byte from EEPROM
5: Write multiple byte to EEPROM
4
Read Multi-Byte operation selected, please enter the location in hex with 16-bit size
0000
Valid address input, please wait while the operation process
address in hex = 0x0000000000000000
Enter the number of byte of data to write/read into/from the eeprom in hexadecimal (Maximum: 255 Bytes)
05
Number of bytes to read: 00000005
Read operation successful.
0x00000001 0x00000002 0x00000003 0x00000004 0x00000005
-
This example can only be used either for Trion T120F324 or T120F576 Development Kit.
-
The input to the terminal is in hexadecimal number. You are not require to add “0x” to your input.