|
我项目上用OMAPL138的板子MCASP的引脚都是链接的FPGA,所以在FPGA这端设置的MCASP自环。把axr0接收到的通过axr1发回去。 部分代码如下 input mcasp_afsx,
4 f: B3 s# I! n U. [4 G1 kinput mcasp_ahclkx,
9 V9 M: p: J% K0 c9 u, [7 ~input mcasp_aclkx,& `; X( ^# J [/ o6 s
input axr0,7 D0 C- u) f; ^9 B5 v: s
3 o# k! o1 k- F# j
output mcasp_afsr,
6 e( r ]* E( o2 E/ koutput mcasp_ahclkr, _: F6 t. Y; K6 f( {% [# V
output mcasp_aclkr,4 q/ K9 b i1 S
output axr1,
% n/ G8 [/ M" O+ g assign mcasp_afsr = mcasp_afsx;3 a$ R* o @" t. d! N/ d7 X
assign mcasp_aclkr = mcasp_aclkx;, v, B5 U$ I, T' h" r# w, P
assign mcasp_ahclkr = mcasp_ahclkx;
! N. v) r& v/ Qassign axr1 = axr0; 8 c0 F+ r# i) o1 T
" v' Q# F8 O& {' M- l' ?
在OMAPL138这端,通过axr0接口发固定的数,axr1接收。 在配置MACASP的时候,发送全部取内部时钟,接收全部取外部时钟。 一直循环发送,但是接收不到。在FPGA端也没有看到时钟和信号的波形。 部分代码如下,关于edma3的部分未做变化。 * b9 L! e3 C2 J! x0 n
static void McASPI2SConfigure(void)
9 `# F, K J1 ^8 m5 R{
& N ?+ l, |0 s: G- DMcASPRxReset(SOC_MCASP_0_CTRL_REGS);
6 @: E1 I# ^6 v' {0 ZMcASPTxReset(SOC_MCASP_0_CTRL_REGS); /* Enable the FIFOs for DMA transfer */2 j3 L5 [6 G B
McASPReadFifoEnable(SOC_MCASP_0_FIFO_REGS, 1, 1);: d! G ?% i. {6 s. L8 M# l, ^
McASPWriteFifoEnable(SOC_MCASP_0_FIFO_REGS, 1, 1); /* Set I2S format in the transmitter/receiver format units */
; ^1 p% ?" l& ]# A4 y" e$ RMcASPRxFmtI2SSet(SOC_MCASP_0_CTRL_REGS, WORD_SIZE, SLOT_SIZE,
9 w2 z; u! a; U. @& b- i, `3 tMCASP_RX_MODE_DMA);! A+ p4 ?: z: I" Y% n6 B
McASPTxFmtI2SSet(SOC_MCASP_0_CTRL_REGS, WORD_SIZE, SLOT_SIZE,
, c0 \7 s. h4 O; T) {* ]4 n! [MCASP_TX_MODE_DMA); /* Configure the frame sync. I2S shall work in TDM format with 2 slots */8 `! T1 C, Q( n; c# y3 [
McASPRxFrameSyncCfg(SOC_MCASP_0_CTRL_REGS, 2, MCASP_RX_FS_WIDTH_WORD,
/ G2 A$ M' G) Q, }: f$ S) L m) x1 RMCASP_RX_FS_EXT_BEGIN_ON_FALL_EDGE);- z5 m1 \6 c4 e ~1 d
McASPTxFrameSyncCfg(SOC_MCASP_0_CTRL_REGS, 2, MCASP_TX_FS_WIDTH_WORD,
2 a- M( ]6 F0 O! s2 qMCASP_TX_FS_INT_BEGIN_ON_RIS_EDGE); /* configure the clock for receiver *// D' p& u/ a$ C. }
McASPRxClkCfg(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLK_EXTERNAL, 0, 0);
3 A" U$ }1 Z N4 A# Q1 R$ RMcASPRxClkPolaritySet(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLK_POL_RIS_EDGE);
6 A) E1 B6 b# EMcASPRxClkCheckConfig(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLKCHCK_DIV32,
: m5 ~8 i- V P( f' g2 H0x00, 0xFF); /* configure the clock for transmitter */! ~2 b$ L, d% C0 I# V0 [0 u
McASPTxClkCfg(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLK_INTERNAL, 11, 1);
' m+ o% w) ~ |1 O8 B2 xMcASPTxClkPolaritySet(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLK_POL_FALL_EDGE);
* H- K5 ?! u4 LMcASPTxClkCheckConfig(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLKCHCK_DIV32,& e' ]+ a! Z6 D* H+ D) _
0x00, 0xFF);( c$ i) \$ d ]: X' @. ^
- z# f8 {+ E. a& B4 `& i) j
/* Enable synchronization of RX and TX sections */ ( _2 m; h: f% g7 z/ _# z& o" d
McASPTxRxClkSyncEnable(SOC_MCASP_0_CTRL_REGS); /* Enable the transmitter/receiver slots. I2S uses 2 slots */
' s+ s: b0 k4 E( G% \3 MMcASPRxTimeSlotSet(SOC_MCASP_0_CTRL_REGS, I2S_SLOTS);
3 W# ]+ ]6 T+ J" O* b0 WMcASPTxTimeSlotSet(SOC_MCASP_0_CTRL_REGS, I2S_SLOTS); /*
6 I' h+ G. E9 a& ?** Set the serializers, Currently only one serializer is set as/ v# h: @! ^: ^0 {4 B$ u& z1 a
** transmitter and one serializer as receiver.* y0 X7 @* G1 C% F8 r/ U
*/
5 s0 M) u x2 DMcASPSerializerRxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_RX);
?% {/ }/ Q/ q; w+ c% l7 J6 HMcASPSerializerTxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_TX); /*
4 [5 m( Q6 a2 T. y1 k3 s9 x* |' N** Configure the McASP pins
) y/ O9 W x5 u0 w' w** Input - Frame Sync, Clock and Serializer Rx
0 w# H$ ^3 M; U$ Y% V1 Q! _** Output - Serializer Tx is connected to the input of the codec
1 d% X' m, Y! n# m4 X*/7 c% ^, V8 k+ Z5 e" h2 H# G
McASPPinMcASPSet(SOC_MCASP_0_CTRL_REGS, 0xFFFFFFFF);
! l, l" z" b0 T% P: j/ p* lMcASPPinDirOutputSet(SOC_MCASP_0_CTRL_REGS,MCASP_PIN_AXR(MCASP_XSER_TX));# x) |1 h- [( {6 ^
McASPPinDirInputSet(SOC_MCASP_0_CTRL_REGS, MCASP_PIN_AFSX
& l2 U" S* }) L! {- F/ P| MCASP_PIN_ACLKX& \- d, z- P# j6 Z# b
| MCASP_PIN_AHCLKX2 }9 s* ^# d z6 H9 `- X k
| MCASP_PIN_AXR(MCASP_XSER_RX)); /* Enable error interrupts for McASP */4 V0 }4 ^. k0 Q& `- n' h% s
McASPTxIntEnable(SOC_MCASP_0_CTRL_REGS, MCASP_TX_DMAERROR & a2 z7 u( V: D3 C
| MCASP_TX_CLKFAIL & u) i5 u& y2 W% Y9 l- l
| MCASP_TX_SYNCERROR
( @/ }; @9 v6 D| MCASP_TX_UNDERRUN); McASPRxIntEnable(SOC_MCASP_0_CTRL_REGS, MCASP_RX_DMAERROR : [6 H+ m4 Y6 P2 G& W% L8 N1 C+ I
| MCASP_RX_CLKFAIL
) Q% V5 `$ O* a* s. K& ~4 ]9 _) \| MCASP_RX_SYNCERROR
' _0 ^% I% }# s& Z| MCASP_RX_OVERRUN);' L7 b* V* M2 _& a9 n3 }/ N
} static void I2SDataTxRxActivate(void)
+ i9 s: y2 G1 X1 e! Y+ F+ f+ d3 E- n) u{
7 ?+ E! L! e4 g P! F1 x# Q# F( D/* Start the clocks */
' V+ d' ]5 n4 P7 w- @McASPRxClkStart(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLK_EXTERNAL);" u; t* U: `& j8 }
McASPTxClkStart(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLK_INTERNAL); /* Enable EDMA for the transfer */
) D0 u/ s9 g1 |, Z, [. m4 CEDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_CHA_MCASP0_RX,
, K; H9 D/ J+ K* l+ r- oEDMA3_TRIG_MODE_EVENT);
- j/ F3 N- [' i$ M8 S# t3 g4 `EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, ( n2 e- |) [4 \6 O( g/ |) S
EDMA3_CHA_MCASP0_TX, EDMA3_TRIG_MODE_EVENT); /* Activate the serializers */
4 n2 v' j; D- ~! O0 m# EMcASPRxSerActivate(SOC_MCASP_0_CTRL_REGS);5 w5 \2 M8 W. X) @5 }5 P/ r- O# d2 S
McASPTxSerActivate(SOC_MCASP_0_CTRL_REGS); /* make sure that the XDATA bit is cleared to zero */( o/ J8 r0 ~5 h3 P0 Y* G
while(McASPTxStatusGet(SOC_MCASP_0_CTRL_REGS) & MCASP_TX_STAT_DATAREADY); /* Activate the state machines */
7 T+ ?, I5 t& W) ~8 [6 b9 pMcASPRxEnable(SOC_MCASP_0_CTRL_REGS);
$ o8 b/ z8 e6 F6 W0 z( g6 R2 nMcASPTxEnable(SOC_MCASP_0_CTRL_REGS);2 b& x' X3 ^' L
}
. ^: l \* Q7 i, I- z- F' T" ^& T请问:问题出在哪了,时钟按照这样配是否有错。 另外我看XDATA一直是0,接收的rxbuf0,1,2里有一般全是FFFF一半全是0.
% |$ I+ [( d8 y# \ |