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. OleDbConnection SqlConnection DB2Connection 区别

    OleDbConnection适合于连接任何类型的数据库(如Oracle,SQL   Server,ACCESS等),其命名空间为:using System.Data.OleDb;.而SqlConne ...

  2. Python笔记(十):正则表达式

    正则表达式对比工具 https://pan.baidu.com/s/1XIPyF1vFSj5PACPx9zW8_g (一)      正则表达式符号和特殊字符 符号 说明 示例 | 或 re1|re2 ...

  3. Prometheus Node_exporter 之 Memory Detail Vmstat

    Memory Detail Vmstat 查看/proc/vmstat 文件的内容 1. Memory Pages In / Out type: GraphUnit: shortLabel: Page ...

  4. SQL Server 子查询错误:No column name was specified for column 2 of 'a' error (转载)

    问: I have a MySQL query and I ran it working fine but same query showing error in SQL Server. SQL Se ...

  5. windows安装Anaconda3

    目录 windows安装Anaconda3 环境 安装 windows安装Anaconda3 by 铁乐与猫 环境 windows7 64位 Anaconda3 5.2.0版本 windows64位 ...

  6. 配置nginx支持TP框架

    TP框架配置中默认URL_MODEL=1,而Nginx默认是不支持PATHINFO的.如果我们只想跑起来tp框架,很简单,只需到更改TP配置,设置URL_MODEL=3(兼容模式).但是如果要让Ngi ...

  7. tidb导入大量数据报错:statement count 5001 exceeds the transaction limitation, autocommit = false

    这是Tidb数据库事务提交数量达到上限的一种报错:因为tidb是分布式的数据库,tikv使用了底层的强一致性协议.这是分布式数据库必然遇到的一个问题,我们可以调整这个值:在tidb的配置文件里面“st ...

  8. 打开Excel时提示“向程序发送命令时出现问题”

    Excel界面中点击“文件”,选择“选项”,在弹出的“Excel选项”对话框中依次点击“高级”-“常规”,然后取消勾选”忽略使用动态数据交换(DDE)的其他应用程序”:

  9. 有关于分布式缓存Hazelcast

    如果在内网段中部署或者启动缓存服务.不能存在相同的组名称.如同使用dubbo一样,会导致无法连接到缓存节点

  10. 矩阵dp

    矩阵dp 这里是矩阵dp,不是矩阵乘法优化dp. 矩阵上的dp好像也没什么特殊的?大概有一个套路就是从上向下,从左向右进行dp吧. 首先第一道题好像不是矩阵dp... 1005 矩阵取数游戏:http ...