MCASP自环配置。 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 9720|回复: 0
打印 上一主题 下一主题

[未解决] MCASP自环配置。

[复制链接]

6

主题

12

帖子

1214

积分

金牌会员

Rank: 6Rank: 6

积分
1214
跳转到指定楼层
楼主
发表于 2018-11-7 13:28:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
我项目上用OMAPL138的板子MCASP的引脚都是链接的FPGA,所以在FPGA这端设置的MCASP自环。把axr0接收到的通过axr1发回去。
部分代码如下
input mcasp_afsx,
8 x/ B, a. ^& Y6 V2 G' Xinput mcasp_ahclkx,
, q, q3 r- G# x8 V" x- Tinput mcasp_aclkx,
( v% `& K) J( L' t' F( h5 f; U4 ?input axr0,. S9 I0 n' Y, N- a9 X1 z
# j( c8 ]" `$ t5 T% ~1 O- s( K1 ?
output mcasp_afsr,
* D% ?  D- U6 b/ S! v: q* qoutput mcasp_ahclkr,
9 F6 s0 \, e( k0 uoutput mcasp_aclkr,
0 A0 P" \) V  x  woutput axr1,
; E' L7 B' J- m! t9 T, ^0 Y9 q
assign mcasp_afsr = mcasp_afsx;: k  K+ S: g2 {1 f9 g! r
assign mcasp_aclkr = mcasp_aclkx;
+ N1 F, i% w% q5 G7 Eassign mcasp_ahclkr = mcasp_ahclkx;0 w; ^% T% i) z2 [" v# A+ c( R: f' W
assign axr1 = axr0;
/ l& M- _% F( }6 `

5 P% y$ Y& R% Q& e
在OMAPL138这端,通过axr0接口发固定的数,axr1接收。
在配置MACASP的时候,发送全部取内部时钟,接收全部取外部时钟。
一直循环发送,但是接收不到。在FPGA端也没有看到时钟和信号的波形。
部分代码如下,关于edma3的部分未做变化。

4 U, k3 c6 ~) I2 [2 o
static void McASPI2SConfigure(void)
) l& ?5 d! a/ T& u6 P8 g- A. e{1 j# v2 |: Q! H
McASPRxReset(SOC_MCASP_0_CTRL_REGS);
4 z1 j: s+ a. X2 q  ?7 i1 HMcASPTxReset(SOC_MCASP_0_CTRL_REGS);
/* Enable the FIFOs for DMA transfer */4 W# e2 G5 u' H- b* m
McASPReadFifoEnable(SOC_MCASP_0_FIFO_REGS, 1, 1);
  ^8 h, z( u! y, I, ^! n# v3 RMcASPWriteFifoEnable(SOC_MCASP_0_FIFO_REGS, 1, 1);
/* Set I2S format in the transmitter/receiver format units */6 i2 i2 I7 \; P& Y8 i4 K
McASPRxFmtI2SSet(SOC_MCASP_0_CTRL_REGS, WORD_SIZE, SLOT_SIZE,/ r* B7 ]5 F1 w6 m+ H
MCASP_RX_MODE_DMA);
! X) h* h* \' x% j9 lMcASPTxFmtI2SSet(SOC_MCASP_0_CTRL_REGS, WORD_SIZE, SLOT_SIZE,
! M7 m- `% h. d* C4 _MCASP_TX_MODE_DMA);
/* Configure the frame sync. I2S shall work in TDM format with 2 slots */
  p$ E) x7 X$ V4 ^8 \McASPRxFrameSyncCfg(SOC_MCASP_0_CTRL_REGS, 2, MCASP_RX_FS_WIDTH_WORD,
. A  Q+ c5 o* e# X: p- qMCASP_RX_FS_EXT_BEGIN_ON_FALL_EDGE);
  x& X* n. J; ~6 h9 B' ~# t1 rMcASPTxFrameSyncCfg(SOC_MCASP_0_CTRL_REGS, 2, MCASP_TX_FS_WIDTH_WORD,
8 w$ D" k4 ~- V- B5 |; h, jMCASP_TX_FS_INT_BEGIN_ON_RIS_EDGE);
/* configure the clock for receiver */5 S9 c3 E0 ~7 ~# H
McASPRxClkCfg(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLK_EXTERNAL, 0, 0);- g( N5 k6 p) H$ S/ I' X8 x
McASPRxClkPolaritySet(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLK_POL_RIS_EDGE); 7 |$ l; p6 d! a% E9 O2 R& a8 C
McASPRxClkCheckConfig(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLKCHCK_DIV32,
' h) Y& h9 q5 a$ ?/ k! W8 e0x00, 0xFF);
/* configure the clock for transmitter */( @' P5 e& n5 x' _7 o" g/ v) x
McASPTxClkCfg(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLK_INTERNAL, 11, 1);( K3 W( s  N% W: O/ ?6 ^9 a
McASPTxClkPolaritySet(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLK_POL_FALL_EDGE);
" }) M9 s/ ]5 r2 V* JMcASPTxClkCheckConfig(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLKCHCK_DIV32,0 \' U8 H( O2 s( @& K$ n. q
0x00, 0xFF);  Z5 ~6 y% [5 A( b  B; a! q# ^" v% \

6 E- A7 K2 f& C! t* z/* Enable synchronization of RX and TX sections */ 8 s% Z; R- Q! m, X& u2 U
McASPTxRxClkSyncEnable(SOC_MCASP_0_CTRL_REGS);
/* Enable the transmitter/receiver slots. I2S uses 2 slots */
; Q* J8 w5 S2 ?McASPRxTimeSlotSet(SOC_MCASP_0_CTRL_REGS, I2S_SLOTS);) e9 W* e* M' I/ z5 }" x1 D9 n
McASPTxTimeSlotSet(SOC_MCASP_0_CTRL_REGS, I2S_SLOTS);
/*
+ w( F; ]! R3 L9 B5 t; h** Set the serializers, Currently only one serializer is set as
  n( q& ]7 i. r% t2 _- A5 {** transmitter and one serializer as receiver.
: v7 ^' _; h, R9 X8 W*/
; ?, }% X5 o; e, \1 e( l! r+ FMcASPSerializerRxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_RX);' ]2 R3 P6 P" Z8 R) s% S
McASPSerializerTxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_TX);
/*
( |- r+ X& G! C  @** Configure the McASP pins
/ T6 D: U4 w+ D** Input - Frame Sync, Clock and Serializer Rx$ V- W  f1 P+ ^$ O
** Output - Serializer Tx is connected to the input of the codec
4 `2 n" F6 F, E. {. T*/
$ t2 ]# Q( O- C$ C; B, l- {1 fMcASPPinMcASPSet(SOC_MCASP_0_CTRL_REGS, 0xFFFFFFFF);
3 {# q" s8 F& f- u" k0 UMcASPPinDirOutputSet(SOC_MCASP_0_CTRL_REGS,MCASP_PIN_AXR(MCASP_XSER_TX));( h6 Y: U) K/ `: ?6 L6 O3 n3 a* U
McASPPinDirInputSet(SOC_MCASP_0_CTRL_REGS, MCASP_PIN_AFSX6 g( i( f( V* |4 x
| MCASP_PIN_ACLKX2 G9 J3 f) W1 r! w: C& _* y
| MCASP_PIN_AHCLKX9 u/ n6 Y; m3 p
| MCASP_PIN_AXR(MCASP_XSER_RX));
/* Enable error interrupts for McASP */  i! E3 j" \& ?& f( ~6 O& ?
McASPTxIntEnable(SOC_MCASP_0_CTRL_REGS, MCASP_TX_DMAERROR ' y2 Z- E7 p1 A; Y/ |
| MCASP_TX_CLKFAIL # u5 n; J2 ~/ s8 t4 ~3 I! [- k, f; {
| MCASP_TX_SYNCERROR* s: f% @( I* e3 t! U( W/ j" e) Q
| MCASP_TX_UNDERRUN);
McASPRxIntEnable(SOC_MCASP_0_CTRL_REGS, MCASP_RX_DMAERROR
# Z0 e( d8 ~' m. \/ F3 B& b| MCASP_RX_CLKFAIL
+ a2 {" V& X8 R: t| MCASP_RX_SYNCERROR
( Z  P. N  n1 u5 m- S| MCASP_RX_OVERRUN);
6 l) A# I- t7 q}
static void I2SDataTxRxActivate(void)
2 l5 w1 p7 [+ e+ G{5 n% G# s+ Y( x4 q
/* Start the clocks */# \: z$ w: ?$ c  i# o
McASPRxClkStart(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLK_EXTERNAL);
, i0 v) c  A8 H( t/ C( t! {8 pMcASPTxClkStart(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLK_INTERNAL);
/* Enable EDMA for the transfer */( ]3 g0 Q0 Y6 Z3 s  R' C/ H% p
EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_CHA_MCASP0_RX,
2 l' x5 \9 c# r- h0 X- YEDMA3_TRIG_MODE_EVENT);
" o* p! V2 c0 l# |. OEDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, , P6 Z" Y/ R, _/ c7 @, i
EDMA3_CHA_MCASP0_TX, EDMA3_TRIG_MODE_EVENT);
/* Activate the serializers */
  n+ g# p" b0 c4 N% fMcASPRxSerActivate(SOC_MCASP_0_CTRL_REGS);* Q! j; O4 N; [% ]/ J) \" M4 d- Y
McASPTxSerActivate(SOC_MCASP_0_CTRL_REGS);
/* make sure that the XDATA bit is cleared to zero *// c! n% V/ E' t- ~; k  [- i
while(McASPTxStatusGet(SOC_MCASP_0_CTRL_REGS) & MCASP_TX_STAT_DATAREADY);
/* Activate the state machines */
# V4 |7 F% C, z$ A* wMcASPRxEnable(SOC_MCASP_0_CTRL_REGS);
1 s) V6 A" p+ V3 d, N) i1 XMcASPTxEnable(SOC_MCASP_0_CTRL_REGS);
- ~: z( }  k. E7 w& i5 F( U}

! Z6 q8 B0 u$ Q9 r1 ~
请问:问题出在哪了,时钟按照这样配是否有错。
另外我看XDATA一直是0,接收的rxbuf0,1,2里有一般全是FFFF一半全是0.
* {) K) d* ?+ w! y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-1-18 10:39 , Processed in 0.040536 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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