各位朋友:
SPI slave模式CPU轮询可以接收到数据,并且是正确的,但是 配置为中断接收却进步了中断
中断配置代码:
- void Setup_Spi_Interrupt(void)
- {
- //point to the IRQ vector table
- IRQ_setVecs(vectors);
-
- //Globally enable interrupts
- IRQ_globalEnable();
-
- //Enable NMI interrupt
- IRQ_nmiEnable();
-
- //Map McBSP0 RINT0 events(0x0c) to physical interrupt number
- IRQ_map(IRQ_EVT_EXTINT4, IRQ_EVT_RINT0);
-
- //Reset the ext events
- IRQ_reset(IRQ_EVT_EXTINT4);
-
- //Enable the ext events(events are disabled while resetting)
- IRQ_enable(IRQ_EVT_EXTINT4);
- }
中断向量表:
- *------------------------------------------------------------------------------
- * Global symbols defined here and exported out of this file
- *------------------------------------------------------------------------------
- .global _vectors
- .global _c_int00
- .global _vector1
- .global _vector2
- .global _vector3
- .global _c_int04
- .global _vector5
- .global _vector6
- .global _vector7
- .global _vector8
- .global _vector9
- .global _vector10
- .global _vector11
- .global _vector12
- .global _vector13
- .global _vector14 ; Hookup the c_int14 ISR in main()
- .global _vector15
- *------------------------------------------------------------------------------
- * Global symbols referenced in this file but defined somewhere else.
- * Remember that your interrupt service routines need to be referenced here.
- *------------------------------------------------------------------------------
- .ref _c_int00
- *------------------------------------------------------------------------------
- * This is a macro that instantiates one entry in the interrupt service table.
- *------------------------------------------------------------------------------
- VEC_ENTRY .macro addr
- STW B0,*--B15
- MVKL addr,B0
- MVKH addr,B0
- B B0
- LDW *B15++,B0
- NOP 2
- NOP
- NOP
- .endm
- *------------------------------------------------------------------------------
- * This is a dummy interrupt service routine used to initialize the IST.
- *------------------------------------------------------------------------------
- _vec_dummy:
- B B3
- NOP 5
- *------------------------------------------------------------------------------
- * This is the actual interrupt service table (IST). It is properly aligned and
- * is located in the subsection .text:vecs. This means if you don't explicitly
- * specify this section in your linker command file, it will default and link
- * into the .text section. Remember to set the ISTP register to point to this
- * table.
- *------------------------------------------------------------------------------
- .sect ".text:vecs"
- .align 1024
- _vectors:
- _vector0: VEC_ENTRY _c_int00 ;RESET
- _vector1: VEC_ENTRY _vec_dummy ;NMI
- _vector2: VEC_ENTRY _vec_dummy ;RSVD
- _vector3: VEC_ENTRY _vec_dummy
- _vector4: VEC_ENTRY _c_int04
- _vector5: VEC_ENTRY _vec_dummy
- _vector6: VEC_ENTRY _vec_dummy
- _vector7: VEC_ENTRY _vec_dummy
- _vector8: VEC_ENTRY _vec_dummy
- _vector9: VEC_ENTRY _vec_dummy
- _vector10: VEC_ENTRY _vec_dummy
- _vector11: VEC_ENTRY _vec_dummy
- _vector12: VEC_ENTRY _vec_dummy
- _vector13: VEC_ENTRY _vec_dummy
- _vector14: VEC_ENTRY _vec_dummy ; Hookup the c_int14 ISR in main()
- _vector15: VEC_ENTRY _vec_dummy
- *------------------------------------------------------------------------------
- ********************************************************************************
- * End of vecs.asm
- ********************************************************************************
MCBSP0配置:
void ConfigMcbsp(MCBSP_Handle *hMcbsp_ch0)
{
MCBSP_Config MyMcbspConfig;
*hMcbsp_ch0 = MCBSP_open(0, MCBSP_OPEN_RESET);
//串口控制寄存器
MyMcbspConfig.spcr= (Uint32)
((MCBSP_SPCR_XINTM_XRDY << _MCBSP_SPCR_XINTM_SHIFT )
|(MCBSP_SPCR_RINTM_RRDY << _MCBSP_SPCR_RINTM_SHIFT )
|(MCBSP_SPCR_CLKSTP_DELAY << _MCBSP_SPCR_CLKSTP_SHIFT )
|(MCBSP_SPCR_DLB_OFF << _MCBSP_SPCR_DLB_SHIFT )
//|( MCBSP_SPCR_XRST_1 << _MCBSP_SPCR_XRST_SHIFT )
//|( MCBSP_SPCR_RINTM_FRM << _MCBSP_SPCR_RINTM_SHIFT )
);
//接收控制寄存器
MyMcbspConfig.rcr = (Uint32)
((MCBSP_RCR_RPHASE_SINGLE << _MCBSP_RCR_RPHASE_SHIFT )
|(MCBSP_RCR_RCOMPAND_DEFAULT << _MCBSP_RCR_RCOMPAND_SHIFT )//MSB
|(MCBSP_RCR_RFIG_YES << _MCBSP_RCR_RFIG_SHIFT )
|(MCBSP_RCR_RDATDLY_0BIT << _MCBSP_RCR_RDATDLY_SHIFT )
|(MCBSP_RCR_RWDLEN1_8BIT << _MCBSP_RCR_RWDLEN1_SHIFT )//8BIT
|(MCBSP_RCR_RFRLEN1_DEFAULT << _MCBSP_RCR_RFRLEN1_SHIFT )
);
//发送控制寄存器
MyMcbspConfig.xcr = (Uint32)
((MCBSP_XCR_XPHASE_SINGLE << _MCBSP_XCR_XPHASE_SHIFT )
|(MCBSP_XCR_XCOMPAND_DEFAULT << _MCBSP_XCR_XCOMPAND_SHIFT )//MSB
//|(MCBSP_XCR_XCOMPAND_8BITLSB << _MCBSP_XCR_XCOMPAND_SHIFT )//lSB
|(MCBSP_XCR_XFIG_YES << _MCBSP_XCR_XFIG_SHIFT )
|(MCBSP_XCR_XDATDLY_0BIT << _MCBSP_XCR_XDATDLY_SHIFT )
|(MCBSP_XCR_XWDLEN1_8BIT << _MCBSP_XCR_XWDLEN1_SHIFT )//8BIT
|(MCBSP_XCR_XFRLEN1_DEFAULT << _MCBSP_XCR_XFRLEN1_SHIFT )
);
//采样率产生寄存器
MyMcbspConfig.srgr= (Uint32)
((MCBSP_SRGR_CLKSM_INTERNAL << _MCBSP_SRGR_CLKSM_SHIFT )
|(MCBSP_SRGR_FSGM_DXR2XSR << _MCBSP_SRGR_FSGM_SHIFT )
//|(MCBSP_SRGR_FSGM_FSG << _MCBSP_SRGR_FSGM_SHIFT )//ERROR
|(MCBSP_SRGR_CLKGDV_OF(0) << _MCBSP_SRGR_CLKGDV_SHIFT )//20M
);
//引脚控制
MyMcbspConfig.pcr = (Uint32)
((MCBSP_PCR_XIOEN_SP << _MCBSP_PCR_XIOEN_SHIFT )
|(MCBSP_PCR_RIOEN_SP << _MCBSP_PCR_RIOEN_SHIFT )
|(MCBSP_PCR_FSXM_EXTERNAL << _MCBSP_PCR_FSXM_SHIFT )
|(MCBSP_PCR_FSRM_EXTERNAL << _MCBSP_PCR_FSRM_SHIFT )
|(MCBSP_PCR_CLKXM_INPUT << _MCBSP_PCR_CLKXM_SHIFT )//slave
|(MCBSP_PCR_CLKRM_INPUT << _MCBSP_PCR_CLKRM_SHIFT )//slave
|(MCBSP_PCR_FSXP_ACTIVELOW << _MCBSP_PCR_FSXP_SHIFT )
|(MCBSP_PCR_FSRP_ACTIVELOW << _MCBSP_PCR_FSRP_SHIFT )
//|(MCBSP_PCR_CLKXP_RISING << _MCBSP_PCR_CLKXP_SHIFT )
|(MCBSP_PCR_CLKXP_FALLING << _MCBSP_PCR_CLKXP_SHIFT )
|(MCBSP_PCR_CLKRP_FALLING << _MCBSP_PCR_CLKRP_SHIFT )
);
MCBSP_config(*hMcbsp_ch0, &MyMcbspConfig);
} /* end config_mcbsp */
是否在slave模式下不能中断接收呢,请指点,谢谢!