嵌入式开发者社区

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

作者: piliyouke    时间: 2017-4-7 16:58
标题: omapl138中 dsp端time_create问题 定时时间不准确
[color=inherit !important] 我们这边用的你们的开发板,测试双核功能,目前遇到的问题是:
' @" V0 F5 V2 p2 ^. i6 K[color=inherit !important]1.ARM端Linux 系统正常进入到文件系统中& `: C! n% S8 B* F) K
[color=inherit !important]7 W/ G7 o+ T: \- P# }, F  j

  h9 L3 P) ]5 l" u[color=inherit !important]2.DSP端运行基于sysbios的工程,在工程中通过如下设置定时器2
0 R4 s) Y# _0 \4 a) h& X[color=inherit !important]8 V) x, U! c1 N
' Y( B4 b# q7 d( g/ |3 j
timerParams.period = 500;
6 m4 T" i- w# ?timerParams.periodType = Timer_PeriodType_MICROSECS;

. g! N+ j& U0 f) z2 wTimer_create(2, Timer2Proc, &timerParams, &eb);; p# r: x$ Q# X' N: N

' Z: y& p* J/ l  C! f/ A

" y" ~# o4 ]1 _- u9 Z3.然后在定时器Timer2Proc()中断函数中进行翻转GPIO的操作,然后用示波器去看GPIO的波形,发现产生的波形周期为960us(正常应该是1000us);
6 ?; M% S  Y( i: U8 d! Y  H产生了定时器定时周期和我预设的周期值不一样。附件是我dsp.cfg文件(只能上传一部分)。请教一下这个问题是什么原因导致的,如何解决,谢谢。
" I9 @/ x, w2 |# W1 Z7 y7 r& g- k+ r3 l5 u& ^# a

( \, P$ t6 T( g! n- g7 M
# t$ t3 k$ l9 G) z( ]8 ]/*2 g4 N/ S' c& o' h) P
*  ======== Dsp.cfg ========) w5 w$ c/ s1 u
*% q, f% ]# V. z* q) p& r/ u
*/  c! O. t! D( J. m' `
$ m; U& X$ D* k" k2 |- b
. N- ^0 N( U$ X% e; B2 l/ e
/* root of the configuration object model */; s6 C! S% B7 ]3 q( O' c' k5 H; f
var Program = xdc.useModule('xdc.cfg.Program');: P, ?! w# ?& {

5 p0 }6 V4 i' n) T+ y, {

( C( M( ~: R# k- {/* application uses the following modules and packages */
" E" Q) N4 U! S5 W! E) Dxdc.useModule('xdc.runtime.Assert');
" `- d/ B- _' \+ I/ l" R: sxdc.useModule('xdc.runtime.Diags');
, z, W+ u$ V. J" kxdc.useModule('xdc.runtime.Error');' b/ F0 S  B+ T7 U2 [& X4 H
xdc.useModule('xdc.runtime.Log');+ o$ O; p3 b9 e) E% Q
xdc.useModule('xdc.runtime.Registry');4 T, P9 D' w+ b* z. j

) F% W: v. m' t7 O

% m6 I  W/ g$ l0 q) `xdc.useModule('ti.sysbios.gates.GateHwi');
4 g* K- E* Y! W( e8 B- mxdc.useModule('ti.sysbios.knl.Semaphore');
2 w4 A/ B+ ?; l  T9 a0 Q$ ~xdc.useModule('ti.sysbios.knl.Task');
  N( L4 E. f9 p4 j3 G. m
; ]+ |9 g: i7 j$ b/ l' K2 H
9 R# K% Y/ @' G6 _/ L

9 R: [1 ?: i% Q* R. `; }) f9 B3 L
! q5 d& h' ?/ d. J& ^9 l5 g
& }4 h: }3 k5 w6 J5 H& @2 O" i; Q) J5 p" y- y& p/ @8 E

! ]7 |0 d# n5 b# h1 z. ?5 Svar BIOS = xdc.useModule('ti.sysbios.BIOS');
( D: `" C) X8 o: jBIOS.libType = BIOS.LibType_NonInstrumented;4 B, e2 |, `2 f0 W+ L' L, H. j

8 y; l& ?0 Z. _+ Y
6 X" F& V  V0 i; h4 P( h% R. Y

9 d: Q2 f. h" c# f5 G9 Q* {' X8 nxdc.useModule('ti.syslink.ipc.rtos.Syslink');" B/ S, d7 l& }  j$ n
4 i( t$ }% c# U3 v' R/ Z

8 K- U# a* b* o' ~& d* O2 I+ G5 ?, `- ]% i# f$ s2 X$ m! H
var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');5 H4 K  D: W, B5 X& E9 x: D
var procNameAry = MultiProc.getDeviceProcNames();8 {3 P$ ~0 M  D0 g3 Y" u) ~* `$ I
MultiProc.setConfig("DSP", procNameAry);
; ]: s6 X+ U1 l7 A: p4 Y' J' q+ ~1 z* Z% d2 d, w" p6 \

2 e: ?% t7 H6 I+ [+ B/ r8 F0 N, m6 T) s3 [
var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');# O* R5 R% l$ a
6 O) ]6 [; S0 O: U+ ?

: a7 T4 N8 y9 s' ~1 `* I2 s: V: P* \8 M5 D
Ipc.sr0MemorySetup = false;
) C( ]0 \. G% q4 x5 s" A/ d. R7 C- d( t" u

2 g  \7 g* m) [- T) z8 l  H! Y& y: t% ?7 P9 _$ D' m% q% t
Ipc.procSync = Ipc.ProcSync_PAIR;
$ `8 C8 m% G7 N$ S0 F5 ?% K7 h
. p8 H" Y) D: ~2 h) E
5 T+ q4 x! [" |. A
/* define host processor */
# K) E3 z' G' P9 k) `Ipc.hostProcId = MultiProc.getIdMeta("HOST");
# e# W2 _' l# r1 u' {
+ z5 @8 M1 O' y  i( A. \% j
! o: ^' Y- p# b! l) {$ U8 m8 D6 _
/* shared region configuration */7 H7 P: j' ]9 L' n. h- e% Y* I! _( d3 e
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
* H7 _8 F, V9 T  ]% G. o1 Q4 ^* H4 Y4 b3 O# N6 F9 b

% Q1 w) q, w0 r/* configure SharedRegion #0 (IPC) */
) y9 u( Z3 w. z8 n/ |var SR0Mem = Program.cpu.memoryMap["SR_0"];
" ]- I8 G6 j; |% s1 u: D
' ]7 F6 Q  I( }  m
6 r9 j4 `& w2 \6 r% B) R% \& c  l$ e
SharedRegion.setEntryMeta(0,
* ^" h; R& ^8 B  b! H/ T) D    new SharedRegion.Entry({
$ }  ]1 u+ I9 C% C2 ?        name:           "SR0",6 ?4 ~9 E: P. d" R
        base:           SR0Mem.base,
9 \; y7 Y& C7 _. O9 L        len:            SR0Mem.len,0 H* F5 [9 j( k9 P+ R6 d; Z8 W& E
        ownerProcId:    MultiProc.getIdMeta("HOST"),
+ h- `- f5 J' u7 E: F+ I& S! w+ x2 j" @        cacheEnable:    false,- p9 f" v9 L" t2 f+ V+ ~
        isValid:        true
# b" a7 z2 q$ e& P    })
$ Q5 N, p+ s/ @);# q3 R( s3 N2 e) l9 }& m/ r' C
2 u6 P. }7 X5 A6 z& u

3 L, @3 W, f1 U& w8 _1 ~" C
9 e1 y; q( K% s# [( a5 E- Q; _( ?
8 d/ [2 S# p$ w7 }
Cache = xdc.useModule('ti.sysbios.family.c64p.Cache');1 |" G5 ^+ K( I4 U
Cache.MAR192_223   = 0x00000008;  /* xxxx xxxx xxxx xxxx xxxx xxxx xxxx 10xx */! g" s) `* H0 c/ @, K: d9 z

. ^: a. l0 Y. B3 I7 C/ ^& ?
& I% K5 ~- h* q" D) N# j( `9 A
9 h! n8 E# ^4 A0 W# |

1 d  h8 Q% [! \0 V/*
+ Y/ ?: Z% ]3 P* M4 w" u& `, {" r *  ======== Operating System Configuration ========2 W9 S  A/ i$ o/ Q8 M; Z7 w
*/$ m# Q! P! D- V* C) A8 }% _7 U

2 A7 c9 p& c! c0 e( |) i# g! m4 t

3 h. x6 o! \% v* f$ l/* no rts heap */
/ N2 t( h% W1 ?+ U! E, j4 ^Program.heap = 0;
7 T, Y( U( r$ `Program.argSize = 100;  /* minimum size */
5 o' C7 F- c% k9 S; E4 zProgram.stack = 0x1000;
1 `% Q! h& @6 d! z2 p, L6 `& E
+ M8 f# X5 \5 e% b; S, S6 q
2 K# K1 X7 x+ z7 Q/ n5 m
/* create a default heap */
/ B/ d8 |! S. Evar HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');' j& E& o/ t  m4 r: j7 u0 K% d
var heapMemParams = new HeapMem.Params();! a! t& y+ G* _& z# q  P$ I
heapMemParams.size = 0x4000;
$ J' B" I, w+ U
$ R' F3 ?: I* D" K  t2 A

! X% a: V* r, ?3 t. _. S5 rvar Memory = xdc.useModule('xdc.runtime.Memory');
5 e( W" M* X% y! l( k! ~* jMemory.defaultHeapInstance = HeapMem.create(heapMemParams);
& R6 F- h$ S. S. _9 ]/ w1 z4 @4 D
* B- z3 N' C* m! H& b

/ ~" b& Y  a6 m) P+ f3 q, B/* configure System module */
4 t, k* w3 a' N0 J% H5 T' ?var SysMin = xdc.useModule('xdc.runtime.SysMin');
% Y' L6 r  D3 {* E' }) ISysMin.bufSize = 0x1000;, A+ ^4 _# e3 u/ ?
SysMin.flushAtExit = false;
' F6 z" u+ E( N5 K- m8 d
" }. s$ ?" r3 B! e! i4 g
* Y" o- {5 @: w3 d- P) E5 \
var System = xdc.useModule('xdc.runtime.System');/ e! g; z, @* O3 s
System.SupportProxy = SysMin;1 m8 w: ]. ^( N! G5 F9 _3 p
5 f0 U7 D' b! w! ?& g: S' V

8 h7 b0 Q$ h/ ]5 n% M7 ?/* configure SysBios to use the lower half of Timer 1 */
) J' Q! p! x# c3 t2 pvar Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
4 V) M9 d+ C" z# K5 k( ^var Clock = xdc.useModule('ti.sysbios.knl.Clock');
" a: B* P$ L9 @$ }$ k0 ~5 ?Timer.timerSettings[1].master = true;1 k- X" c( ?) q7 ~" {; P
Timer.defaultHalf = Timer.Half_LOWER;+ p" f; Z$ p/ S6 Y% S
Clock.timerId = 1;
3 {# E0 `' x. \8 |! L% ?4 F; @$ M! Z" L

- |/ x. P, L1 `" p# a
$ a8 z  f  ]# {8 `% b" p! k5 `! D9 ]& G6 ^" E& p; J# x# G( F

作者: human    时间: 2017-4-10 12:01
ARM 端将定时器2/3 输入时钟配置为 156MHz 需要修改 DSP 端 CFG 文件配置




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