TMS320VC5509驱动AT24C02
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的更多相关文章
- 单片机驱动AT24C02存储芯片
AT24C02是一个2K位串行CMOS E2PROM, 内部含有256个8位字节,CATALYST公司的先进CMOS技术实质上减少了器件的功耗.AT24C02有一个8字节页写缓冲器.该器件通过IIC总 ...
- TMS320VC5509驱动LCD1602
1. 本次使用5509芯片的EMIF接口,先看下硬件的接口 LCD1602接口 RS(高电平1数据寄存器,低电平0指令寄存器) 接A2接口 LCD1602接口 RW(高电平读,低电平写) 接 AW ...
- TMS320VC5509驱动LCD1602之奇怪问题和时序图
1. 最近调试自己板子上LCD1602的时候,看下测试的时序图,因为下面的时序图导致LCD1602无法显示,下面的时序图是有问题的,E的上升沿和下降沿的时候,RW需要低电平 对比下淘宝上买的可以显示的 ...
- TMS320VC5509驱动74HC595芯片
1. 5509A有3个MCBSP模块,其中模块MCBSP可以配置成SPI模式,不过实际使用的时候需要把CLKX1和CLKR1接在一起,暂时没搞明白原因 MCBSP有6个引脚,DR0 RX0 作为数据的 ...
- TMS320VC5509驱动TLV32AIC23
1. 本次使用LINE_IN作为输入,LINE_OUT作为输出(可以插耳机),代码如下,代码经过测试,没问题,不过发现了一个很奇怪的问题没搞明白 /************************** ...
- Linux I2C核心、总线和设备驱动
目录 更新记录 一.Linux I2C 体系结构 1.1 Linux I2C 体系结构的组成部分 1.2 内核源码文件 1.3 重要的数据结构 二.Linux I2C 核心 2.1 流程 2.2 主要 ...
- I.MX6 AT24Cxx eeprom Linux i2c-gpio
/************************************************************************** * I.MX6 AT24Cxx eeprom L ...
- AM335x kernel 4.4.12 i2c eeprom AT24c02驱动移植
kernel 4.4.12 i2c eeprom AT24c02驱动移植 在kernel make menuconfig ARCH=ARM 中打开: Device Drivers ---> Mi ...
- TMS320VC5509总线驱动LED灯
1. 重新建立的工程,需要添加宏定义才行 CHIP_5509 2. 驱动LED用的是74LVC573锁存器,LE高电平时,Q1=D0,LE低电平时,Q1=之前的状态,下面是数据总线 看下地址总线 看下 ...
随机推荐
- Python笔记(四):异常处理机制与 open()
(一) 异常处理机制概述 就像日常生活中会遇到各种意外情况一样(例如:你可能考虑过如果中了500w该怎么做),代码运行过程中也会遇到这种意外情况,python提供了这么一种机制,处理意外情况(就像如 ...
- Oracle EBS 物化视图
怎么理解物化视图呢,先随意拿一个建物化视图的例子看一下. create materialized view EBS_ACCOUNTS_HIERARCHY_MV refresh complete on ...
- 总结Linux 下Redis 操作常用命令(转)
Redis的配置 Linux下安装 ]# wget http://download.redis.io/releases/redis-2.8.17.tar.gz ]# tar xzf redis-2.8 ...
- net.exe use命令的使用
net.exe use 查看当前的连接 net.exe use * /del /y 断开所有连接 net.exe use \\server\share "password" /us ...
- scp 利用 ssh 协议 复制文件
有时候,我们使用 scp 命令可以解决我们很多问题: NAME scp — secure copy (remote file copy program) 使用举例:拷贝当前文件,到 系统 10.66. ...
- 正确计算linux系统内存使用率
参考:https://blog.gesha.net/archives/406/ 图中的例子很典型,就是:多数的linux系统在free命令后会发现free(剩余)的内存很少,而自己又没有开过多的程序或 ...
- (一)SSO之CAS框架通俗原理
版权声明:本文为博主原创文章.转载请标明出处. https://blog.csdn.net/lovesummerforever/article/details/36068249 SSO统一验证 ...
- zabbix_windowsagent_cpu
zabbix的WEB端--配置-模板--Template OS Windows--项目--创建项目 名称:UserPerfCountercpu 键值:UserPerfCountercpu 数据类型:数 ...
- Invalid action class configuration that references an unknown class named [XX] .
多次遇到这个错误,难以解决,有时候出现,有时候没有,很神奇,今天发现了一点端倪,虽然说不上找到了所有导致这个bug的原因.至少,也是很主要的一种了. 其实,透过结果,如果debug用心,一行代码一行代 ...
- Flume学习之路 (二)Flume的Source类型
一.概述 官方文档介绍:http://flume.apache.org/FlumeUserGuide.html#flume-sources 二.Flume Sources 描述 2.1 Avro So ...