嵌入式开发者社区

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

作者: piliyouke    时间: 2017-4-7 16:58
标题: omapl138中 dsp端time_create问题 定时时间不准确
[color=inherit !important] 我们这边用的你们的开发板,测试双核功能,目前遇到的问题是:
$ B; E6 v2 U3 g: }2 S6 V[color=inherit !important]1.ARM端Linux 系统正常进入到文件系统中7 Y7 P8 Z, h, e" S
[color=inherit !important]
9 A  R( }+ Y+ O1 p& J
) C. V% c0 p( u6 I7 l; j* r
[color=inherit !important]2.DSP端运行基于sysbios的工程,在工程中通过如下设置定时器2
+ s+ a1 a. `* a$ I& _9 i[color=inherit !important]
" H7 t6 Y* j, S8 v+ ~
4 {& Z4 j) e! ^; }' V
timerParams.period = 500;
8 K# |  s0 l9 i) `5 _0 f# _timerParams.periodType = Timer_PeriodType_MICROSECS;
" B# ]# x0 X! m) w' K9 R. R
Timer_create(2, Timer2Proc, &timerParams, &eb);8 ^; v3 `. E+ b( W. o( m- {
. G1 J- b7 o$ P. n3 q

6 {; a$ m. P" y( {' T3.然后在定时器Timer2Proc()中断函数中进行翻转GPIO的操作,然后用示波器去看GPIO的波形,发现产生的波形周期为960us(正常应该是1000us);
6 @  Z7 u' ?' \/ Q& c/ Q& ~产生了定时器定时周期和我预设的周期值不一样。附件是我dsp.cfg文件(只能上传一部分)。请教一下这个问题是什么原因导致的,如何解决,谢谢。* G! N, z# p6 n7 S  V3 B
1 r& m2 N  I9 T) B9 c3 x3 \

" X9 _% j9 h& G
3 p( C% o" i' N& Q4 ]/*2 a+ W; y$ B, _+ w: b& B
*  ======== Dsp.cfg ========5 o' P/ n6 z; n2 I: a! `
*
: t. a2 |4 R1 s$ m9 ^1 Z- @ */
1 Q$ q8 |- O% c& ?
' w8 h) x% o% K- d' o$ s& {

8 M# K4 h5 X0 A, Z' z0 M, X' i' Q/* root of the configuration object model */& V* V9 b2 Y! G9 U  J3 V
var Program = xdc.useModule('xdc.cfg.Program');
' T& z! }0 }: o1 @& g4 y5 A9 y
! u3 {/ T5 _$ T( j' L" ]
; w) M/ n- v* K% r4 Z( ^
/* application uses the following modules and packages */: \& J/ J2 p2 }: p& A% h; ~
xdc.useModule('xdc.runtime.Assert');/ e6 A) F& {- q! A
xdc.useModule('xdc.runtime.Diags');* P3 X( g: R9 @: k: t2 s3 \
xdc.useModule('xdc.runtime.Error');
0 C7 x8 {/ P# \' ~, B8 b9 t$ g5 cxdc.useModule('xdc.runtime.Log');
% }8 k9 T, j# Q1 C( L( [xdc.useModule('xdc.runtime.Registry');
. L. ?+ v! u. A: W1 m' Q! V% ~) R/ w8 D: L! }
# g: L5 I5 _' I2 x( W  E
xdc.useModule('ti.sysbios.gates.GateHwi');
! L, P( U( l* H) ]) W3 yxdc.useModule('ti.sysbios.knl.Semaphore');
" n2 ?# Q7 ~/ y8 Y# u& K# p3 Ixdc.useModule('ti.sysbios.knl.Task');: g- ?) \/ g. K: x, F
& b" C! q+ v: m- n$ ~

- U- l6 I  A) P! }" v+ F; f4 |( R. G
& S5 z- U, k- p& a$ p* _. O  l% P6 o- s! ]

" l" k. a& A" o& [4 N% ]1 H# M
2 J1 v! P& C% [( N" J
7 c# {7 U: n0 z- T+ d* p
var BIOS = xdc.useModule('ti.sysbios.BIOS');) m% e8 J! R. {, t: E' ^. J
BIOS.libType = BIOS.LibType_NonInstrumented;0 ~  i# j9 X4 m0 O0 x

( b2 S, c$ @4 M. f
$ |3 G) y" H- @- m' u! P
- f4 {6 Y) F9 w8 s
xdc.useModule('ti.syslink.ipc.rtos.Syslink');4 M5 S4 C0 _& E4 O6 S! r9 E
% O$ e3 H5 {/ }3 X* x$ f
2 f0 A  u, n2 E3 }- g

- }+ L( H( p; c) _2 N  L0 D8 |. m( O2 N. Ovar MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');* m6 `$ C$ F7 M, u' X6 K
var procNameAry = MultiProc.getDeviceProcNames();$ u; [8 x. _9 a6 A+ e" U
MultiProc.setConfig("DSP", procNameAry);
3 o9 J! a2 f. D. ^/ a
- E; h4 }1 t. r4 d6 Q
0 H5 T; t5 F2 k7 m7 z9 A
/ K; ^0 k4 H7 r2 N
var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
4 k" ]; V6 v/ a+ \& a! k0 y& x' B& v' x( q3 z- z

* _6 |( V8 s; x  S( u1 c( ?+ [( @5 R$ l* {. n
Ipc.sr0MemorySetup = false;- I' X# P" _* x. }4 O
) w" o% R5 X& ~# F; s* q" [7 S/ h

: J7 Z0 V" F8 t8 W6 K- `
7 |+ n  i5 o7 fIpc.procSync = Ipc.ProcSync_PAIR;3 r/ m1 W- P6 h9 ], @8 S
2 Q( F: v( T+ Q' x, z" _

# u9 ~! A' ?3 X9 \0 ^/* define host processor */; \, ~4 ~' r/ D- J7 j3 l. z
Ipc.hostProcId = MultiProc.getIdMeta("HOST");' d( q0 y' Q$ w0 e/ O5 n

9 I6 s% E  L: M
7 e+ M7 z6 s; A
/* shared region configuration */# J& B( r7 A5 H& I+ Q
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
3 K* _0 O! B& k2 z
% E2 t8 w) O" ~; h& F  ^7 v
' j( b% P5 a7 `7 K
/* configure SharedRegion #0 (IPC) */3 l: x9 k/ @9 E8 I, B' j
var SR0Mem = Program.cpu.memoryMap["SR_0"];6 N6 q! D* E3 G5 \) }& I# e) F7 z! F1 R1 n" T
: F4 g3 _7 G: m9 y

6 [/ k2 |7 L' u% H8 k3 I" f3 ~. CSharedRegion.setEntryMeta(0,
; Z  x* W: ?' y% u) E, s    new SharedRegion.Entry({4 V7 E  B& ^, r0 c
        name:           "SR0",
0 m# t6 C4 _/ V: E- Y& Y. Z        base:           SR0Mem.base,. u1 {8 `! n; `, U6 V
        len:            SR0Mem.len,
  B& M) U7 s& F- H# Z/ C( R        ownerProcId:    MultiProc.getIdMeta("HOST"),
, Q$ d+ Q; e& d8 ?4 v        cacheEnable:    false,
  s- m5 z# ^1 h% a$ ]7 }: a        isValid:        true; v  L5 K& b+ z8 [# S6 E
    })
/ |1 S2 u; S/ f5 m5 B: P( l9 ^' v);$ I( F& z% g) j/ W8 J/ Y
0 [- r: N8 H  L1 Q& p# b' c$ @! p

) [& M+ c& T& v8 V/ V! o- Q( W5 W: I6 s$ y9 }
' F0 ~, y- i8 ?+ w. \( F
' `& V# ^# p, M  ~
Cache = xdc.useModule('ti.sysbios.family.c64p.Cache');' t# |2 \& m0 b
Cache.MAR192_223   = 0x00000008;  /* xxxx xxxx xxxx xxxx xxxx xxxx xxxx 10xx */6 o8 R) \& \, h- \$ S$ T
/ S! b) \+ ~9 p3 j
( l# \) ~3 E  r

) {6 O: n8 P0 w8 {

$ q% j; v7 d# [$ \5 x& ~- q1 a/*! t% F* f( U& t6 j+ m
*  ======== Operating System Configuration ========
# |/ g6 A# Q* H+ V */
+ L: K7 ?/ q3 z3 F( l# ~  }7 D) l- H, \! z

1 P# R2 _7 h! |8 h) u$ T. h/* no rts heap */8 |, U: T3 j) y
Program.heap = 0;* @, A; b; B8 x- ~
Program.argSize = 100;  /* minimum size */
  u" o1 i5 J- s, Z5 D; lProgram.stack = 0x1000;) n0 o$ y: b) K

9 o3 l  m/ U& _7 p* ]

, c0 D& f  S( {2 a0 D0 o$ J. B6 t/* create a default heap */9 f' I# l! e) w5 r+ s( k$ I3 W5 z& Y
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
; W: J7 p; `1 P. E5 F) g4 Z0 ?, Q# {var heapMemParams = new HeapMem.Params();0 r0 @$ a7 m9 l7 R, P5 S$ z; o
heapMemParams.size = 0x4000;, i! e7 m( |: N5 w( R7 }
) W" ]0 R$ x9 a, o; I

/ k& q% t) H  W* Z% ?( kvar Memory = xdc.useModule('xdc.runtime.Memory');% r$ ^% U! c2 r* k# ~6 ^# ?
Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+ n, p1 E6 |# [* N7 C) c3 e9 y  H! z! d/ N
5 ?2 p( W7 Z: w* _1 C# L
/* configure System module */
; h- C( e' u0 p5 ^  F$ H" {1 gvar SysMin = xdc.useModule('xdc.runtime.SysMin');
- K/ c$ w8 |8 d# @SysMin.bufSize = 0x1000;, F6 m: {) l/ r& T5 K
SysMin.flushAtExit = false;
' {. ]8 M" U  P/ z# ~/ ^4 s  C/ ]# I7 e7 ]

( ]0 ^% X" J* l! L5 avar System = xdc.useModule('xdc.runtime.System');
9 v6 ?5 \; P+ k( ?System.SupportProxy = SysMin;
3 c5 _- g8 c. R  H) e2 c
0 y, r" c2 G* V) y
( S% ?5 n; ]2 h  b
/* configure SysBios to use the lower half of Timer 1 */
8 D6 C/ @0 y* V% A& p! {var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');; ]3 S1 M# D/ Z0 e
var Clock = xdc.useModule('ti.sysbios.knl.Clock');! S% J" H1 G- o# [# ~
Timer.timerSettings[1].master = true;
% J3 H; J8 l) n. u# H+ FTimer.defaultHalf = Timer.Half_LOWER;5 L5 p7 Z$ M0 }; j: J# ]7 g' V6 l
Clock.timerId = 1;# ^  A0 Y" C5 n
; W6 f% J" B$ F' _
% K- I  e, Y$ q* F
8 S: v0 r9 g' M' S2 A( ^( o

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




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