完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
|
相关推荐
15 个讨论
|
|
这是我CMD文件: /**********************************************************/ /* */ /* LINKER command file for LEAD3 memory map */ /* */ /**********************************************************/ MEMORY [ PAGE 0: MMR : origin = 0000000h, length = 00000c0h SPRAM : origin = 00000c0h, length = 0000040h VECS : origin = 0000100h, length = 0000100h DARAM0 : origin = 0000200h, length = 0003E00h DARAM1 : origin = 0004000h, length = 0004000h DARAM2 : origin = 0008000h, length = 0004000h DARAM3 : origin = 000c000h, length = 0004000h SARAM0 : origin = 0010000h, length = 0004000h SARAM1 : origin = 0014000h, length = 0005000h SARAM2 : origin = 0019000h, length = 0003000h SARAM3 : origin = 001c000h, length = 0004000h SARAM4 : origin = 0020000h, length = 0004000h SARAM5 : origin = 0024000h, length = 0004000h SARAM6 : origin = 0028000h, length = 0004000h SARAM7 : origin = 002c000h, length = 0004000h SARAM8 : origin = 0030000h, length = 0004000h SARAM9 : origin = 0034000h, length = 0004000h SARAM10 : origin = 0038000h, length = 0004000h SARAM11 : origin = 003c000h, length = 0004000h SARAM12 : origin = 0040000h, length = 0004000h SARAM13 : origin = 0044000h, length = 0004000h SARAM14 : origin = 0048000h, length = 0004000h SARAM15 : origin = 004c000h, length = 0004000h CE0 : origin = 0050000h, length = 03b0000h CE1 : origin = 0400000h, length = 0400000h CE2 : origin = 0800000h, length = 0400000h CE3 : origin = 0c00000h, length = 03f8000h PDROM : origin = 0ff8000h, length = 07f00h /* VECS : origin = 0ffff00h, length = 00100h */ /* reset vector */ ] SECTIONS [ vectors : [] > VECS PAGE 0 /* interrupt vector table */ .cinit : [] > SARAM0 PAGE 0 .text : [] > SARAM1 PAGE 0 isrs : [] > SARAM2 PAGE 0 .stack : [] > DARAM0 PAGE 0 .sysstack: [] > DARAM0 PAGE 0 .sysmem : [] > DARAM1 PAGE 0 .data : [] > DARAM1 PAGE 0 .bss : [] > DARAM1 PAGE 0 .const : [] > DARAM1 PAGE 0 .cio : [] > DARAM1 PAGE 0 .csldata: [] > DARAM0 PAGE 0 ] 0X002050地址的值是对的。 |
|
|
|
|
|
lksas 发表于 2018-7-31 08:26 一直能正常运行,用中断。 现在我把程序改了,只发送。 程序如下: /* * UART.C * * Created on: 2014-12-23 * Author: Administrator */ /*----------------------------------------------------------------------------*/ /* DESCRIPTION: */ /* */ /* This is an example for EMIF of C5509A */ /*----------------------------------------------------------------------------*/ /* MODULE NAME... Mcbsp */ /* FILENAME...... uart.c */ /* DATE CREATED.. Mon 02/4/2004 */ /* COMPONENT..... */ /* PREREQUISITS.. */ /*----------------------------------------------------------------------------*/ /* DESCRIPTION: */ /* */ /* this example is that the software uart is done by Mcbsp */ /*----------------------------------------------------------------------------*/ #include #include #include #include #include #include //设置McBSP的PCR寄存器指针,用于读写其I/O端口 ioport unsigned int *PCR_1=(unsigned int *)0x2c12; #define REG_PCR1 (*PCR_1) /*锁相环的设置*/ PLL_Config myConfig = [ 0, //IAI: the PLL locks using the same process that was underway //before the idle mode was entered 1, //IOB: If the PLL indicates a break in the phase lock, //it switches to its bypass mode and restarts the PLL phase-locking //sequence 12, //PLL multiply value; multiply 12 times 0 //Divide by 1 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) ]; /****************************设置Timer********************************/ /* 参考: TMS320VC5509 DSP Timers Reference Guide TMS320C55x Chip Support Library API Reference Guide (Rev. J) HX-5509A 开发板使用手册 */ //---------Global data definition---------// #define TIMER_CTRL TIMER_TCR_RMK( TIMER_TCR_IDLEEN_DEFAULT, /* IDLEEN == 0 */ TIMER_TCR_FUNC_OF(0), /* FUNC == 0 */ TIMER_TCR_TLB_RESET, /* TLB == 1 */ TIMER_TCR_SOFT_BRKPTNOW, /* SOFT == 0 */ TIMER_TCR_FREE_WITHSOFT, /* FREE == 0 */ TIMER_TCR_PWID_OF(0), /* PWID == 0 */ TIMER_TCR_ARB_RESET, /* ARB == 1 */ TIMER_TCR_TSS_START, /* TSS == 0 */ TIMER_TCR_CP_PULSE, /* CP == 0 */ TIMER_TCR_POLAR_LOW, /* POLAR == 0 */ TIMER_TCR_DATOUT_0 /* DATOUT == 0 */ ) /* Create a TIMER configuration structure that can be passed */ /* to TIMER_config CSL function for initialization of Timer */ /* control registers. */ //产生1ms中断 TIMER_Config timCfg0 = [ TIMER_CTRL, /* TCR0 */ 749, /* PRD0 */ 0x0000 /* PRSC */ ]; /* Create a TIMER_Handle object for use with TIMER_open */ TIMER_Handle mhTimer0; Uint16 eventId0; Uint16 timer0_cnt = 0; int old_intm; Uint16 tim_val; //---------Function prototypes--------- /* Reference start of interrupt vector table */ /* This symbol is defined in file, vectors_timer1.s55 */ extern void VECSTART(void); /* Function/ISR prototypes */ interrupt void timer0Isr(void); /***********************************************************************/ /**************************McBSP1设置成GPIO*****************************/ /* 参考: TMS320C55x DSP Multichannel Buffered Serial Port (McBSP) Reference Guide HX-5509A 开发板使用手册 TMS320C55x Chip Support Library API Reference Guide (Rev. J) */ MCBSP_Config Mcbsptest; MCBSP_Config Mcbsp1Config = [ MCBSP_SPCR1_RMK( MCBSP_SPCR1_DLB_OFF, /* DLB = 0,禁止自闭环方式 */ MCBSP_SPCR1_RJUST_LZF, /* RJUST = 2 */ MCBSP_SPCR1_CLKSTP_DISABLE, /* CLKSTP = 0 */ MCBSP_SPCR1_DXENA_ON, /* DXENA = 1 */ 0, /* ABIS = 0 */ MCBSP_SPCR1_RINTM_RRDY, /* RINTM = 0 */ 0, /* RSYNCER = 0 */ MCBSP_SPCR1_RRST_DISABLE /* RRST = 0 */ ), MCBSP_SPCR2_RMK( MCBSP_SPCR2_FREE_NO, /* FREE = 0 */ MCBSP_SPCR2_SOFT_NO, /* SOFT = 0 */ MCBSP_SPCR2_FRST_FSG, /* FRST = 0 */ MCBSP_SPCR2_GRST_CLKG, /* GRST = 0 */ MCBSP_SPCR2_XINTM_XRDY, /* XINTM = 0 */ 0, /* XSYNCER = N/A */ MCBSP_SPCR2_XRST_DISABLE /* XRST = 0 */ ), /*单数据相,接受数据长度为16位,每相2个数据*/ MCBSP_RCR1_RMK( MCBSP_RCR1_RFRLEN1_OF(1), /* RFRLEN1 = 1 */ MCBSP_RCR1_RWDLEN1_16BIT /* RWDLEN1 = 2 */ ), MCBSP_RCR2_RMK( MCBSP_RCR2_RPHASE_SINGLE, /* RPHASE = 0 */ MCBSP_RCR2_RFRLEN2_OF(0), /* RFRLEN2 = 0 */ MCBSP_RCR2_RWDLEN2_8BIT, /* RWDLEN2 = 0 */ MCBSP_RCR2_RCOMPAND_MSB, /* RCOMPAND = 0 */ MCBSP_RCR2_RFIG_YES, /* RFIG = 0 */ MCBSP_RCR2_RDATDLY_1BIT /* RDATDLY = 1 */ ), MCBSP_XCR1_RMK( MCBSP_XCR1_XFRLEN1_OF(1), /* XFRLEN1 = 1 */ MCBSP_XCR1_XWDLEN1_16BIT /* XWDLEN1 = 2 */ ), MCBSP_XCR2_RMK( MCBSP_XCR2_XPHASE_SINGLE, /* XPHASE = 0 */ MCBSP_XCR2_XFRLEN2_OF(0), /* XFRLEN2 = 0 */ MCBSP_XCR2_XWDLEN2_8BIT, /* XWDLEN2 = 0 */ MCBSP_XCR2_XCOMPAND_MSB, /* XCOMPAND = 0 */ MCBSP_XCR2_XFIG_YES, /* XFIG = 0 */ MCBSP_XCR2_XDATDLY_1BIT /* XDATDLY = 1 */ ), MCBSP_SRGR1_DEFAULT, MCBSP_SRGR2_DEFAULT, MCBSP_MCR1_DEFAULT, MCBSP_MCR2_DEFAULT, MCBSP_PCR_RMK( MCBSP_PCR_IDLEEN_RESET, /* IDLEEN = 0 */ MCBSP_PCR_XIOEN_GPIO, /* XIOEN = 1 */ MCBSP_PCR_RIOEN_GPIO, /* RIOEN = 1 */ MCBSP_PCR_FSXM_EXTERNAL, /* FSXM = 0 */ MCBSP_PCR_FSRM_EXTERNAL, /* FSRM = 0 */ MCBSP_PCR_CLKXM_INPUT, /* CLKXM = 0 */ MCBSP_PCR_CLKRM_INPUT, /* CLKRM = 0 */ MCBSP_PCR_SCLKME_NO, /* SCLKME = 0 */ MCBSP_PCR_DXSTAT_1, /* DXSTAT = 1 */ MCBSP_PCR_FSXP_ACTIVEHIGH, /* FSXP = 0 */ MCBSP_PCR_FSRP_ACTIVEHIGH, /* FSRP = 1 */ MCBSP_PCR_CLKXP_FALLING, /* CLKXP = 1 */ MCBSP_PCR_CLKRP_RISING /* CLKRP = 1 */ ), MCBSP_RCERA_DEFAULT, MCBSP_RCERB_DEFAULT, MCBSP_RCERC_DEFAULT, MCBSP_RCERD_DEFAULT, MCBSP_RCERE_DEFAULT, MCBSP_RCERF_DEFAULT, MCBSP_RCERG_DEFAULT, MCBSP_RCERH_DEFAULT, MCBSP_XCERA_DEFAULT, MCBSP_XCERB_DEFAULT, MCBSP_XCERC_DEFAULT, MCBSP_XCERD_DEFAULT, MCBSP_XCERE_DEFAULT, MCBSP_XCERF_DEFAULT, MCBSP_XCERG_DEFAULT, MCBSP_XCERH_DEFAULT ]; MCBSP_Handle hMcbsp; /***********************************************************************/ Uint16 i,temp; unsigned char timer0_cnten; unsigned char uart_rec, uart_send, uart_recflag, uart_sendflag; unsigned char uart_bitscan, uart_bitcnt, uart_recstart, uart_sendbitcnt; unsigned char uart_bitsend, uart_bitsendcnt, uart_sendcnten, uart_sendend; void delay(Uint32 k) [ while(k--); ] void settimer(void) [ /* Set IVPH/IVPD to start of interrupt vector table */ /*修改寄存器IVPH,IVPD,重新定义中断向量表*/ IRQ_setVecs((Uint32)(&VECSTART)); /* Temporarily disable all maskable interrupts */ old_intm = IRQ_globalDisable(); /* Open Timer 0, set registers to power on defaults */ mhTimer0 = TIMER_open(TIMER_DEV0, TIMER_OPEN_RESET); /* Get Event Id associated with Timer 0, for use with */ /* CSL interrupt enable functions. */ eventId0 = TIMER_getEventId(mhTimer0); /* Clear any pending Timer interrupts */ IRQ_clear(eventId0); /* Place interrupt service routine address at */ /* associated vector location */ IRQ_plug(eventId0,&timer0Isr); /* Write configuration structure values to Timer control regs */ TIMER_config(mhTimer0, &timCfg0); /* Enable Timer interrupt */ IRQ_enable(eventId0); /* Enable all maskable interrupts */ IRQ_globalEnable(); timer0_cnten = 0; uart_bitscan = 0; uart_bitcnt = 0; uart_recstart = 0; uart_recflag = 0; uart_sendflag = 0; /* Start Timer */ TIMER_start(mhTimer0); ] void main(void) [ /* Initialize CSL library - This is REQUIRED !!! */ /*初始化CSL库*/ CSL_init(); /*设置系统的运行速度为144MHz*/ PLL_config(&myConfig); /*初始化McBSP1*/ hMcbsp = MCBSP_open(MCBSP_PORT1,MCBSP_OPEN_RESET); /*设置McBSP1*/ MCBSP_config(hMcbsp,&Mcbsp1Config); MCBSP_getConfig(hMcbsp,&Mcbsptest); settimer(); uart_bitsendcnt = 0; uart_sendend = 0; uart_sendcnten = 0; uart_bitsend = 0; uart_send = 0X0; uart_sendflag = 1; uart_sendbitcnt = 0; /*************************以下程序实现软件Uart************************/ /* 参考:HX-5509A 开发板使用手册 */ while(TRUE) [ ]; ] interrupt void timer0Isr(void) [ temp = REG_PCR1; //Send if(uart_sendflag==1) [ if(uart_sendcnten==0) [ REG_PCR1 &= 0xffdf; uart_bitsend = 1; uart_sendcnten = 1; ] if(uart_sendcnten==1) [ uart_bitsendcnt++; if(uart_bitsendcnt==10) [ uart_sendbitcnt++; if(uart_sendend==1) [ uart_sendflag = 0; ] else [ if(uart_sendbitcnt<9) [ if((uart_send & uart_bitsend)==0) [ REG_PCR1 &= 0xffdf; ] else [ REG_PCR1 |= 0x0020; ] uart_bitsend <<= 1; ] else [ REG_PCR1 |= 0x0020; uart_sendflag = 0; ] ] uart_bitsendcnt = 0; ] ] ] ] /****************************************************************************** * End of uart.c ******************************************************************************/ cmd文件也改了,是这样: /**********************************************************/ /* */ /* LINKER command file for LEAD3 memory map */ /* */ /**********************************************************/ MEMORY [ PAGE 0: MMR : origin = 0000000h, length = 00000c0h SPRAM : origin = 00000c0h, length = 0000040h VECS : origin = 0000100h, length = 0000100h DARAM0 : origin = 0000200h, length = 0003E00h DARAM1 : origin = 0004000h, length = 0004000h DARAM2 : origin = 0008000h, length = 0004000h DARAM3 : origin = 000c000h, length = 0004000h SARAM0 : origin = 0010000h, length = 0004000h SARAM1 : origin = 0014000h, length = 0005000h SARAM2 : origin = 0019000h, length = 0003000h SARAM3 : origin = 001c000h, length = 0004000h SARAM4 : origin = 0020000h, length = 0004000h SARAM5 : origin = 0024000h, length = 0004000h SARAM6 : origin = 0028000h, length = 0004000h SARAM7 : origin = 002c000h, length = 0004000h SARAM8 : origin = 0030000h, length = 0004000h SARAM9 : origin = 0034000h, length = 0004000h SARAM10 : origin = 0038000h, length = 0004000h SARAM11 : origin = 003c000h, length = 0004000h SARAM12 : origin = 0040000h, length = 0004000h SARAM13 : origin = 0044000h, length = 0004000h SARAM14 : origin = 0048000h, length = 0004000h SARAM15 : origin = 004c000h, length = 0004000h CE0 : origin = 0050000h, length = 03b0000h CE1 : origin = 0400000h, length = 0400000h CE2 : origin = 0800000h, length = 0400000h CE3 : origin = 0c00000h, length = 03f8000h PDROM : origin = 0ff8000h, length = 07f00h /* VECS : origin = 0ffff00h, length = 00100h */ /* reset vector */ ] SECTIONS [ vectors : [] > VECS PAGE 0 /* interrupt vector table */ .cinit : [] > SARAM0 PAGE 0 .text : [] > SARAM1 PAGE 0 isrs : [] > SARAM2 PAGE 0 .stack : [] > SARAM4 PAGE 0 .sysstack: [] > SARAM4 PAGE 0 .sysmem : [] > SARAM5 PAGE 0 .data : [] > SARAM3 PAGE 0 .bss : [] > SARAM3 PAGE 0 .const : [] > SARAM6 PAGE 0 .cio : [] > SARAM6 PAGE 0 .csldata: [] > SARAM7 PAGE 0 ] CMD文件改的是都在SARAM区。 我uart_send是发送的值,我给这个变量赋0x55,0,1,可以发出数来,但都是0xf8。 |
|
|
|
|
|
只有小组成员才能发言,加入小组>>
NA555DR VCC最低电压需要在5V供电,为什么用3.3V供电搭了个单稳态触发器也使用正常?
671 浏览 3 评论
MSP430F249TPMR出现高温存储后失效了的情况,怎么解决?
598 浏览 1 评论
对于多级放大电路板,在PCB布局中,电源摆放的位置应该注意什么?
1052 浏览 1 评论
735 浏览 0 评论
普中科技F28335开发板每次上电复位后数码管都会显示,如何熄灭它?
522 浏览 1 评论
请问下tpa3220实际测试引脚功能和官方资料不符,哪位大佬可以帮忙解答下
158浏览 20评论
请教下关于TAS5825PEVM评估模块原理图中不太明白的地方,寻求答疑
120浏览 14评论
在使用3254进行录音的时候出现一个奇怪的现象,右声道有吱吱声,请教一下,是否是什么寄存器设置存在问题?
123浏览 13评论
TLV320芯片内部自带数字滤波功能,请问linein进来的模拟信号是否是先经过ADC的超采样?
122浏览 12评论
TPA6304-Q1: TPA6304 两片公用一组I2C的话,其中一片配置不成功怎么办
164浏览 10评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-23 00:57 , Processed in 0.955283 second(s), Total 72, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号