查看: 3040|回复: 1

[MPC] mpc5606s flexcan问题

[复制链接]

该用户从未签到

0

主题

0

帖子

0

新手上路

Rank: 1

积分
2
最后登录
2014-9-17
发表于 2014-9-17 15:16:06 | 显示全部楼层 |阅读模式
各位大牛你们好,请教一个问题,我在调试5606s flexcan的demo程序时,无法调通,代码如下,把注释删掉了。
 #include "MPC5604B_M27V.h" /* Use proper include file */  
void initModesAndClks(void) {
  ME.MER.R = 0x0000001D;          /* Enable DRUN, RUN0, SAFE, RESET modes */
                                  /* Initialize PLL before turning it on: */
/* Use 1 of the next 2 lines depending on crystal frequency: */
  CGM.FMPLL_CR.R = 0x02400100;    /* 8 MHz xtal: Set PLL0 to 64 MHz */   
  ME.RUN[0].R = 0x001F0074;       /* RUN0 cfg: 16MHzIRCON,OSC0ON,PLL0ON,syclk=PLL */
  ME.RUNPC[1].R = 0x00000010;    /* Peri. Cfg. 1 settings: only run in RUN0 mode */
  ME.PCTL[17].R = 0x01;           /* MPC56xxB/S FlexCAN1:  select ME.RUNPC[1] */ 
  ME.PCTL[68].R = 0x01;           /* MPC56xxB/S SIUL:  select ME.RUNPC[1] */ 

                                  /* Mode Transition to enter RUN0 mode: */
  ME.MCTL.R = 0x40005AF0;         /* Enter RUN0 Mode & Key */
  ME.MCTL.R = 0x4000A50F;         /* Enter RUN0 Mode & Inverted Key */  
  while (ME.GS.B.S_MTRANS) {}     /* Wait for mode transition to complete */    
                                  /* Note: could wait here using timer and/or I_TC IRQ */
  while(ME.GS.B.S_CURRENTMODE != 4) {} /* Verify RUN0 is the current mode */
}

void initPeriClkGen(void) {
 // CGM.SC_DC[1].R = 0x80;            /* MPC56xxB/S: Enable peri set 2 sysclk divided by 1 */
    CGM.SCDC.R = 0x80808000;     /* MPC56xxB/S: Enable peri set 2 sysclk divided by 1 这里做了修改,因为demo例子是56xxB的。*/
}

void disableWatchdog(void) {
  SWT.SR.R = 0x0000c520;     /* Write keys to clear soft lock bit */
  SWT.SR.R = 0x0000d928; 
  SWT.CR.R = 0x8000010A;     /* Clear watchdog enable (WEN) */
}
    
void initCAN_1 (void) 
{
  uint8_t   i;


  CAN_0.MCR.R = 0x5000003F;       /* Put in Freeze Mode & enable all 64 msg bufs */
  CAN_0.CR.R = 0x04DB0006;        /* Configure for 8MHz OSC, 100KHz bit time */
  for (i=0; i
我知道答案 目前已有1人回答
回复

使用道具 举报

该用户从未签到

1

主题

27

帖子

0

注册会员

Rank: 2

积分
111
最后登录
2016-4-25
发表于 2016-4-1 11:23:25 | 显示全部楼层
然后呢?
回复

使用道具 举报

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

本版积分规则

关闭

站长推荐上一条 /3 下一条

Archiver|手机版|小黑屋|恩智浦技术社区

GMT+8, 2025-7-23 03:52 , Processed in 0.085327 second(s), 22 queries , MemCache On.

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表