1. 刚开始的波形不太对,比如如下代码

        i2c_status = I2C_write( at24c02_write_buf,          //pointer to data array
, //length of data to be transmitted
, //master or slaver
0x78, //slave address to transmit to
, //transfer mode of operation
//time out for bus busy
);

但是实际的波形是,把0x78左移了一位,我估计是DSP5509会自动在最后一位加上读写位

所以本次AT24C02的地址是0XA0,那么实际写的应该是0x50

        i2c_status = I2C_write( at24c02_write_buf,          //pointer to data array
, //length of data to be transmitted
, //master or slaver
0x50, //slave address to transmit to
, //transfer mode of operation
//time out for bus busy
);

2. 最后的综合代码如下

#include <csl.h>
#include <csl_i2c.h>
#include <stdio.h>
#include <csl_pll.h>
#include <csl_gpio.h> #define BUF_LEN 20
#define AT24C02_WRITE_ADDR 0x50
#define AT24C02_READ_ADDR 0X50 Uint16 i2c_status; /*锁相环的设置*/
PLL_Config myConfig = {
, //IAI: the PLL locks using the same process that was underway
//before the idle mode was entered
, //IOB: If the PLL indicates a break in the phase lock,
//it switches to its bypass mode and restarts the PLL phase-locking
//sequence
, //PLL multiply value; multiply 24 times
//Divide by 2 PLL divide value; it can be either PLL divide value
//(when PLL is enabled), or Bypass-mode divide value
//(PLL in bypass mode, if PLL multiply value is set to 1)
}; /* This next struct shows how to use the I2C API */
/* Create and initialize an I2C initialization structure */
I2C_Setup I2Cinit = {
, /* 7 bit address mode */
, /* own address - don't care if master */
, /* clkout value (Mhz) */
, /* a number between 10 and 400*/
, /* number of bits/byte to be received or transmitted (8)*/
, /* DLB mode on*/
/* FREE mode of operation on*/
}; Uint16 at24c02_write_buf[] ={0x00,0x00,0x00};
Uint16 test_write_buf[BUF_LEN+] = {};
I2C_Config testI2C; void delay(Uint32 k)
{
while(k--);
} void main(void)
{
unsigned char i= ;
i2c_status = ;
/*初始化CSL库*/
CSL_init(); /*设置系统的运行速度为140MHz*/
PLL_config(&myConfig); /*确定方向为输出*/
GPIO_RSET(IODIR,0xFF);
GPIO_RSET(IODATA,0x00); /*I2C is undet reset*/
I2C_RSET(I2CMDR,);
/*设置预分频寄存器,I2C的mode clock is 10MHz*/
delay();
I2C_RSET(I2CSAR,0x001A);
I2C_RSET(I2CMDR,0x0620); I2C_setup(&I2Cinit);
/*设置I2C的Mater clock*/
I2C_RSET(I2CCLKL,);
I2C_RSET(I2CCLKH,); I2C_getConfig(&testI2C); //
for(i=;i<BUF_LEN;i++)
{
at24c02_write_buf[] = i;
at24c02_write_buf[] = +i;
i2c_status = I2C_write( at24c02_write_buf, //pointer to data array
, //length of data to be transmitted
, //master or slaver
AT24C02_WRITE_ADDR, //slave address to transmit to
, //transfer mode of operation
//time out for bus busy
);
delay();
} for(i=;i<BUF_LEN;i++)
{
at24c02_write_buf[] = i;
at24c02_write_buf[] = ;
test_write_buf[i] = ;
i2c_status = I2C_write( at24c02_write_buf, //pointer to data array
, //length of data to be transmitted
, //master or slaver
AT24C02_WRITE_ADDR, //slave address to transmit to
, //transfer mode of operation
//time out for bus busy
); i2c_status = I2C_read( &(test_write_buf[i]), //pointer to data array
, //length of data to be transmitted
, //master or slaver
AT24C02_READ_ADDR, //slave address to transmit to
, //transfer mode of operation
, //time out for bus busy );
delay();
} while();
}

3. 看下仿真的结果

4. 看下写数据的波形

读数据的波形

TMS320VC5509驱动AT24C02的更多相关文章

  1. 单片机驱动AT24C02存储芯片

    AT24C02是一个2K位串行CMOS E2PROM, 内部含有256个8位字节,CATALYST公司的先进CMOS技术实质上减少了器件的功耗.AT24C02有一个8字节页写缓冲器.该器件通过IIC总 ...

  2. TMS320VC5509驱动LCD1602

    1. 本次使用5509芯片的EMIF接口,先看下硬件的接口 LCD1602接口  RS(高电平1数据寄存器,低电平0指令寄存器) 接A2接口 LCD1602接口  RW(高电平读,低电平写) 接 AW ...

  3. TMS320VC5509驱动LCD1602之奇怪问题和时序图

    1. 最近调试自己板子上LCD1602的时候,看下测试的时序图,因为下面的时序图导致LCD1602无法显示,下面的时序图是有问题的,E的上升沿和下降沿的时候,RW需要低电平 对比下淘宝上买的可以显示的 ...

  4. TMS320VC5509驱动74HC595芯片

    1. 5509A有3个MCBSP模块,其中模块MCBSP可以配置成SPI模式,不过实际使用的时候需要把CLKX1和CLKR1接在一起,暂时没搞明白原因 MCBSP有6个引脚,DR0 RX0 作为数据的 ...

  5. TMS320VC5509驱动TLV32AIC23

    1. 本次使用LINE_IN作为输入,LINE_OUT作为输出(可以插耳机),代码如下,代码经过测试,没问题,不过发现了一个很奇怪的问题没搞明白 /************************** ...

  6. Linux I2C核心、总线和设备驱动

    目录 更新记录 一.Linux I2C 体系结构 1.1 Linux I2C 体系结构的组成部分 1.2 内核源码文件 1.3 重要的数据结构 二.Linux I2C 核心 2.1 流程 2.2 主要 ...

  7. I.MX6 AT24Cxx eeprom Linux i2c-gpio

    /************************************************************************** * I.MX6 AT24Cxx eeprom L ...

  8. AM335x kernel 4.4.12 i2c eeprom AT24c02驱动移植

    kernel 4.4.12 i2c eeprom AT24c02驱动移植 在kernel make menuconfig ARCH=ARM 中打开: Device Drivers ---> Mi ...

  9. TMS320VC5509总线驱动LED灯

    1. 重新建立的工程,需要添加宏定义才行 CHIP_5509 2. 驱动LED用的是74LVC573锁存器,LE高电平时,Q1=D0,LE低电平时,Q1=之前的状态,下面是数据总线 看下地址总线 看下 ...

随机推荐

  1. react单页面应用的Nginx配置问题

    项目中多数使用react单页面开发,路由使用react-router的browser-router,这样页面访问路径看起来像是真实的,如http://xx.xxx.xxx/a/b.但当项目访问路径为多 ...

  2. windows10局域网实现文件共享

    1.共享文件夹设置: 磁盘文件夹,鼠标右键 选择高级共享 如图,自定义选项: 控制面板中添加新用户,一定给设置一个密码(远程登录时候用) 用户: * windows键+R * \\IP地址\目录 * ...

  3. C#中获取数组中相加和最接近或等于(<=)给定值的算法

    , ,,,,,,,,, }; List<List<int>> mylist = new List<List<int>>(); int length = ...

  4. Python中的分组函数(groupby、itertools)

    from operator import itemgetter #itemgetter用来去dict中的key,省去了使用lambda函数 from itertools import groupby ...

  5. selenium-各种定位方法

    selenium各种定位方法. https://www.red-gate.com/simple-talk/wp-content/uploads/imported/1269-Locators_table ...

  6. October 15th 2017 Week 42nd Sunday

    Excellence is a continuous process and not an accident. 卓越是一个持续的过程而不是一个偶然事件. It is said that ten tho ...

  7. Django商城项目笔记No.15用户部分-用户中心邮箱验证

    首先增加前端页面success_verify_email.html页面 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitiona ...

  8. [python]通过uiautomator实现返回当前程序包名

    # -*- coding: utf-8 -*- from uiautomator import device as d def getCurrentPackageName(): info = d.in ...

  9. 难度并不NOIP的NOIP模拟赛

    今天老师请了前几届的学长来讲课,可是讲课为什么要考试呢... 学长说难度是NOIP,于是我就naive的跟着参加了,然而T3难度并不友好,感觉确实不是很适合我们现在做......不过课本来也不是给我们 ...

  10. BZOJ4184:shallot(线段树分治,线性基)

    Description 小苗去市场上买了一捆小葱苗,她突然一时兴起,于是她在每颗小葱苗上写上一个数字,然后把小葱叫过来玩游戏. 每个时刻她会给小葱一颗小葱苗或者是从小葱手里拿走一颗小葱苗,并且 让小葱 ...