4817|1

2

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

用Simulink开发F2812,SCI 或者SPI 通讯没输出,有大大做通过的吗? [复制链接]

        用Matlab里面的links and target 里面的TC2000的工具包进行DSP开发,PWM,GPIO,ADC都能顺利的开发和调试,但是串口通讯一直调试不通,无论是SCI还是SPI都不行,程序没问题,能编译能下载到DSP里面,比如我做的自己收发的小范例,程序运行后,用串口线和PC机连接起来,用串口调试助手向DSP发送数据,但是收不到DSP返回的数据,SCI不通SPI也不通,因为是新手,没用过CCS直接编写程序开发的方式,一直使用Simulink开发的方式,所以对.c文件也不太清楚,个位大大帮我看看啊,生成的.c看看有什么问题,谢谢了.....


附录上生成的 main.c
#include "SPI01.h"
#include "rtwtypes.h"
#include "SPI01_private.h"
#include "c2000_main.h"
#include "DSP281x_Device.h"
#include "DSP281x_Examples.h"
#include <stdlib.h>
#include <stdio.h>

void init_board(void);
void enable_interrupts(void);
void config_schedulerTimer(void);
void disable_interrupts(void);
volatile int IsrOverrun = 0;
static boolean_T OverrunFlag = 0;

/* Associating rt_OneStep with a real-time clock or interrupt service routine
 * is what makes the generated code "real-time".  The function rt_OneStep is
 * always associated with the base rate of the model.  Subrates are managed
 * by the base rate from inside the generated code.  Enabling/disabling
 * interrupts and floating point context switches are target specific.  This
 * example code indicates where these should take place relative to executing
 * the generated code step function.  Overrun behavior should be tailored to
 * your application needs.  This example simply sets an error status in the
 * real-time model and returns from rt_OneStep.
 */
void rt_OneStep(void)
{
  // Check for overrun. Protect OverrunFlag against
  // pre-emption
  asm(" SETC INTM");
  if (OverrunFlag++) {
    IsrOverrun = 1;
    OverrunFlag--;
    asm(" CLRC INTM");
    return;
  }

  asm(" CLRC INTM");
  SPI01_step();

  /* Get model outputs here */
  OverrunFlag--;
}

//
// Entry point into the code
//
void main(void)
{
  volatile boolean_T noErr;
  init_board();
  SPI01_initialize(1);

  /* **starting the model** */
  config_schedulerTimer();
  noErr =
    rtmGetErrorStatus(SPI01_M) == (NULL);
  enable_interrupts();
  while (noErr ) {
    noErr =
      rtmGetErrorStatus(SPI01_M) == (NULL);
  }

  /* **stopping the model** */

  /* Disable rt_OneStep() here */

  /* Terminate model */
  SPI01_terminate();
  disable_interrupts();
}

/* File trailer for Real-Time Workshop generated code.
 *
 * [EOF]
 */







[ 本帖最后由 soloimay 于 2012-5-26 15:43 编辑 ]
 
点赞 关注

回复
举报

2

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
对了 DSP 开发板用的是瑞泰的F2812-A
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条
有奖直播 | AI之眼——安森美图像传感器 报名中
直播时间:2025年4月25日(周五)上午10:00-11:30
直播主题:AI之眼——安森美图像传感器
报名观看直播、直播间提问、填写问卷均有机会获得精美礼品!

查看 »

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

 
机器人开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网 1

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表