Hi!
Sorry for my english, I´ll try to explain myself the best i can.
I´m working with tm4c1294 connected launhcpad and i want to read/write an external EEPROM m24c64 using the i2c API´S on the "driverlib/i2c.h" library;
the first thing i want to do is to write a single character on the 0x00 0x00 address of the EE and then read it from arduino board.
I've been trying but my code doesn't work, when I read the data in 0x00 0x00 address form arduino, the readed data is not which i tried to write with my launchpad.
this is my code, I hope you can help me:
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "inc/hw_i2c.h"
#include "driverlib/gpio.h"
#include "sensorlib/i2cm_drv.h"
#include "drivers/pinout.h"
#include "driverlib/pin_map.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "inc/hw_gpio.h"
#include "driverlib/debug.h"
#include "driverlib/i2c.h"
#include "driverlib/interrupt.h"
#include "driverlib/rom.h"
#include "driverlib/adc.h"
#include "driverlib/uart.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "utils/uartstdio.h"
#include "sensorlib/i2cm_drv.h"
#define address 0x50
unsigned long sysFreq;
void GeneralConfig(){
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
GPIOPinConfigure(GPIO_PB3_I2C0SDA);
GPIOPinConfigure(GPIO_PB2_I2C0SCL);
GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);
HWREG(GPIO_PORTB_AHB_BASE + GPIO_O_PUR) = 0xC;
GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0 | GPIO_PIN_1);
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0 | GPIO_PIN_1, 0x00);
}
void main(){
sysFreq = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |SYSCTL_CFG_VCO_480), 120000000);
GeneralConfig();
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0 | GPIO_PIN_1, 0x01);
I2CMasterInitExpClk(I2C0_BASE, sysFreq , false);
I2CMasterSlaveAddrSet(I2C0_BASE, address, false);
I2CMasterDataPut(I2C0_BASE, 0x00);
I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_START);
while(I2CMasterBusy(I2C0_BASE)){
}
I2CMasterDataPut(I2C0_BASE, 0x00);
I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
while(I2CMasterBusy(I2C0_BASE)){
}
I2CMasterDataPut(I2C0_BASE, 'f' );
I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH);
while(I2CMasterBusy(I2C0_BASE)){
}
SysCtlDelay(sysFreq/3);
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0 | GPIO_PIN_1, 0x00);
SysCtlDelay(sysFreq/3);
while(1){
}
}
Thanks a lot!