嵌入式开发者社区

标题: omapl138中 dsp端time_create问题 定时时间不准确 [打印本页]

作者: piliyouke    时间: 2017-4-7 16:58
标题: omapl138中 dsp端time_create问题 定时时间不准确
[color=inherit !important] 我们这边用的你们的开发板,测试双核功能,目前遇到的问题是:/ n) M- \8 O" B3 z: _' [  R( c$ [$ ?
[color=inherit !important]1.ARM端Linux 系统正常进入到文件系统中2 i# h) [  j8 H
[color=inherit !important]
+ S: _8 u; ]2 X- R# Q+ {% Q& i
+ k9 L+ J* L9 J) P* ^
[color=inherit !important]2.DSP端运行基于sysbios的工程,在工程中通过如下设置定时器20 J9 u6 o5 T) L+ I4 Y
[color=inherit !important]; {# o7 R  Z0 v$ S% z" D
# Y' n- B9 N8 M" U  o
timerParams.period = 500;
7 J& C) g" ]0 ~4 s+ K+ j# h" YtimerParams.periodType = Timer_PeriodType_MICROSECS;

- A, ~9 X* |: F- `/ N. M5 MTimer_create(2, Timer2Proc, &timerParams, &eb);4 q5 x: c# r$ i; l& d/ J' v" _

, x$ A6 y7 b% o
2 E- ?3 I2 W, t3 M, \9 V
3.然后在定时器Timer2Proc()中断函数中进行翻转GPIO的操作,然后用示波器去看GPIO的波形,发现产生的波形周期为960us(正常应该是1000us);# s: o. Z; L+ J2 i2 B
产生了定时器定时周期和我预设的周期值不一样。附件是我dsp.cfg文件(只能上传一部分)。请教一下这个问题是什么原因导致的,如何解决,谢谢。
. W* d+ p# P8 `0 F
, h& s4 N) n* h" k: Z. g# b

) T4 u; s- m7 s9 }
* y  C2 m: Z! v) o- F/*
) V* r9 @- R* d1 } *  ======== Dsp.cfg ========" ^: C: y; Z! P# U$ ~) U
*
) b4 a" m/ b( E; g) P% A *// Y. a+ I& u$ Z6 o
8 e. ]- B/ W5 y+ O' [

# R# a4 U( v+ u0 B4 p7 @/ q/* root of the configuration object model */
: u2 h" w% R; y: A4 ?: wvar Program = xdc.useModule('xdc.cfg.Program');" S1 U* |! k' |  p  g+ T1 r

, {8 H* T: m- C9 B5 V
1 D; c. j  s6 X0 s
/* application uses the following modules and packages */
; f- L/ A: p* ?/ E/ Lxdc.useModule('xdc.runtime.Assert');4 t  `* b5 m+ S
xdc.useModule('xdc.runtime.Diags');
1 u) r. y! \6 }8 C# |+ M& s2 ]% jxdc.useModule('xdc.runtime.Error');
4 _& p$ c& P1 {4 Xxdc.useModule('xdc.runtime.Log');; x. b! Y' y) M* d# V
xdc.useModule('xdc.runtime.Registry');/ s* M' W* ~8 O% V
( o0 @( F4 B; r& R0 C3 H  e+ Y

7 U; Q+ V# w/ m& R% dxdc.useModule('ti.sysbios.gates.GateHwi');: |0 h3 C8 H( Q0 U  e1 L- p
xdc.useModule('ti.sysbios.knl.Semaphore');
$ j* J* @0 @% o, oxdc.useModule('ti.sysbios.knl.Task');. ?# Y' O/ I; x. L& K
, D; [5 ^* I4 V* s4 I* m5 f4 A

8 I& n. Q* G8 x& Q* Y% s. q' {2 w* P; h& f

( ~1 H. U* i( C. O1 ~  M& K: e8 i
8 ]2 U0 y$ G3 q$ S& M& V
0 v& |+ O3 A7 r0 ~8 q# }
  ]- {% m" z5 Y4 }& r9 `( d
var BIOS = xdc.useModule('ti.sysbios.BIOS');
" t( i3 h# X' h* f( ]6 e6 N! ]1 oBIOS.libType = BIOS.LibType_NonInstrumented;
9 T$ i7 O# j- f3 _
9 R1 \' _; T. H7 c( q; |+ g

- {& _6 B# @2 `
( q; a5 u& b4 O: \xdc.useModule('ti.syslink.ipc.rtos.Syslink');
) r9 d1 B# X% T! M; P) Q- ]8 C* X: Q

2 Z, x9 P! H! e4 Q7 A8 ~& v
4 I( S+ z4 k6 f, I8 C; rvar MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');/ _: b% e* e# A! h" E7 K9 K6 g
var procNameAry = MultiProc.getDeviceProcNames();
0 m3 m8 i& W1 d- {1 v8 ]$ E7 k; eMultiProc.setConfig("DSP", procNameAry);  Y" F+ m' c4 |0 {* y
4 P& x4 s8 Z" E5 `' {; b
# a2 Y) e: l3 f2 D6 d

' a, r7 X2 l: B+ y2 ^var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');/ o+ M# O; B1 Q0 ]8 ?: N' x: A

- F* W/ l' T8 T/ s% ~: g2 M2 F- r

. [. y. r* `! t6 M; T/ ^
- Z5 |3 b5 y9 P% R; }Ipc.sr0MemorySetup = false;! U" A5 ]0 o: X
- b6 [! S8 O$ h0 G# k

  @4 n2 V8 B, X6 ?8 C8 U" T. I. T* i
Ipc.procSync = Ipc.ProcSync_PAIR;6 \5 k3 f! F  C2 \) Q
+ t  A( u- K" U# m* k
5 _/ e0 t+ t. K; \% m
/* define host processor */
; r* v# ?6 w( ~9 b8 V1 X3 @Ipc.hostProcId = MultiProc.getIdMeta("HOST");
4 H! x' e0 ]6 H" X! K4 z- s
8 a" {- J) y+ @7 s/ {% x

( m, d1 k3 O" J6 s4 {3 R# i/* shared region configuration */8 c" j' a6 M$ I: |/ |: x
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');/ e! B* ?& |9 _' S

2 ^5 P6 @/ o6 }( `4 V& N

4 e, g3 J' Q( b7 u/ p# m+ [/* configure SharedRegion #0 (IPC) */  j. |6 z( J3 c$ U: D/ X/ H
var SR0Mem = Program.cpu.memoryMap["SR_0"];
; g: q& q, B" W& {, ?9 k
0 i7 f: C  m7 ]( m" a: H

$ T/ S3 [- n* k4 E* I# B; \  gSharedRegion.setEntryMeta(0,
3 V& k7 a, D# P$ S; u4 \    new SharedRegion.Entry({3 i1 d* }& S! B: A
        name:           "SR0",4 ?" ]! P; O8 z3 `7 @
        base:           SR0Mem.base,; n0 J9 O/ s: Z6 M# I
        len:            SR0Mem.len,- E  D8 |- i; M0 h+ S
        ownerProcId:    MultiProc.getIdMeta("HOST"),. H6 s- ]" t$ r' g, I: k
        cacheEnable:    false,# d+ `* ^* u) \" Q5 D
        isValid:        true
/ [+ d' P! k. p$ j$ ?1 H* ^    })2 V* X  X2 l& Y, Y% e% s( @
);$ Z) D4 D  B; ~& R3 ~6 F( m

% v) I: s) D  [, w
$ D4 N$ n  I% L7 i

; Z; Q* l+ J( M
$ X& u% S' I, j& m) M
! m- F; M6 o4 @( s
Cache = xdc.useModule('ti.sysbios.family.c64p.Cache');
" _& u0 D; X$ U0 k( @9 t% y3 V5 nCache.MAR192_223   = 0x00000008;  /* xxxx xxxx xxxx xxxx xxxx xxxx xxxx 10xx */6 R5 `, @/ W! |

: A& f( Y/ W0 ^( P8 Z+ Q( H

5 w0 F, f' s3 Q4 Y2 Z. B
  `  `+ s9 ^& E+ a3 w1 t: A, h/ t

( @: R' X7 O9 R4 L/ O8 z/*- Z, L" A0 r, ]. m
*  ======== Operating System Configuration ========
2 h% A3 y( s" d. g# r6 t& q" q2 r */8 F2 [. b3 g" P

, G  D  Y6 i* D9 I. |$ Z
$ y- H. S* N& e9 Y3 n; e3 S' ^
/* no rts heap */
) ]: X, Q* L0 S. s+ G: zProgram.heap = 0;
" P' Q' k& x4 d8 Y+ D& k+ B+ c% FProgram.argSize = 100;  /* minimum size */0 z, E* F% R' E4 z5 m
Program.stack = 0x1000;
( j) }6 T' b: t+ S! W3 \0 q% s6 `( `
% H9 U' V9 f' @
8 P  U1 \  |; X, x! c  i
/* create a default heap */( E7 J( ]: C) {: C# P
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+ k' q2 D0 \' p. J' P& ^var heapMemParams = new HeapMem.Params();8 s( c+ e! H0 V6 t. A/ O  v4 U
heapMemParams.size = 0x4000;
7 O% q- a0 L4 U3 ?
8 q0 J$ w6 J: f* U

( a2 J+ X3 ^. J+ ]7 ~var Memory = xdc.useModule('xdc.runtime.Memory');5 w1 p1 _& N. p) V2 N
Memory.defaultHeapInstance = HeapMem.create(heapMemParams);2 V! F% f: r3 Q& N; P5 j

) O  p7 \) m. U, v9 ?" z
$ j5 w; m  f. h& S; c) |5 U
/* configure System module */& A& v. X5 U+ K3 F/ H3 P9 E9 A
var SysMin = xdc.useModule('xdc.runtime.SysMin');
* D; Y& v8 u+ l' v0 V6 TSysMin.bufSize = 0x1000;
* C; z2 C' O, {SysMin.flushAtExit = false;
# [4 g/ r4 n! Y3 b3 l7 @8 l
( U5 [" j( ~" ~4 D% X% C
3 f/ h' O3 r; S2 Z$ X4 O6 F
var System = xdc.useModule('xdc.runtime.System');
" \$ L; t) B9 [. U4 N; v6 j+ ASystem.SupportProxy = SysMin;2 q$ `' I, x' z2 A
4 @; S+ Q8 O  ~+ g

, E+ W) U8 f4 Z, d  H: V5 O4 ~4 L$ w/* configure SysBios to use the lower half of Timer 1 */
5 J3 Y& @. G' a! b) e! rvar Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
1 T6 m: h1 w$ jvar Clock = xdc.useModule('ti.sysbios.knl.Clock');
% V6 K/ `* Y# D. ^8 m3 P" GTimer.timerSettings[1].master = true;" g2 H3 {9 a5 C1 J+ ]. h& A
Timer.defaultHalf = Timer.Half_LOWER;0 a, [" o" w4 G) [
Clock.timerId = 1;) \: _0 j- C6 r$ x0 [& o

- P' x  j+ \8 M, R% E$ [7 i- G
9 T$ D( O) i3 P- P
" u# @% G' h0 G
) W! O1 }0 t' j1 |4 b3 i- t
作者: human    时间: 2017-4-10 12:01
ARM 端将定时器2/3 输入时钟配置为 156MHz 需要修改 DSP 端 CFG 文件配置




欢迎光临 嵌入式开发者社区 (https://www.51ele.net/) Powered by Discuz! X3.4