5234 eTPU Quadrature Decoder

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

5234 eTPU Quadrature Decoder

705件の閲覧回数
MorePower
Contributor I

Hi All,

 

I have a NetBurner 5234 interfaced to a linear quadrature encoder.  It supplies A & B signals and an Index signal.  The QD interface is configured to reset the PC (position counter) when the index signal is received.  I'm monitoring the PC value and it resets when the index pulse is received.

 

How can I generate an interrupt to ther CPU when the index pulse is received?

 

I've tried the following -

 

// Enable interrupt on PC value = 0 or 0

fs_etpu_qd_set_pc_interrupts(SignalAChannel, 0, 0);

// SignalAChannel = 0

// SignalBChannel = 1

// IndexChannel = 2

 

 

// Simple isr to increment index count

INTERRUPT( index_isr, 0x2100 )

{

IndexCount = IndexCount + 1;

}

 

SetIntc(1,  // INTC number (0 or 1)

              (long) &index_isr,

               27,  //  Source vector from Table 13-14 of MCF5234/5 Reference Manual

               1, // Interrupt level

               1); //Interrupt priority

 

I'm thinking the source vector is wrong, but what should it be?

Any and all comments welcome.

 

Thanks,

Jay

ラベル(1)
0 件の賞賛
返信
2 返答(返信)

499件の閲覧回数
TomE
Specialist II

Just a quick guess. On the ColdFire chips you have to explicitly "ACK" any interrupts that aren't implicitly ACKed. An "implicit ACL" is for something like a UART where reading the data clears the interrupt.

 

Search for "eTPU" in this forum. I think one of the previous posts gives an example of this.

 

> Source vector from Table 13-14 of MCF5234/5 Reference Manual

 

That shows Interrupt 27 is for the flag TC0F. Make sure you have the eTPU set up to try and set the TC0F flag.

Also read the LAST column in that table where it says "Flag Clearing Mechanism : Write CIC[0] = 1".

 

Tom

 

 

0 件の賞賛
返信

499件の閲覧回数
MorePower
Contributor I

Thanks Tom - I'll explore your suggestions and post any successes.

I eventually gave up on generating an interrupt and just read the position counter and direction.

The interrupt solution would be preferred, but sometimes you just have to git 'er done.

// INITIALIZATION 

ErrorCode = fs_etpu_qd_init(

                  0,

                  0,

                  2,

                  FS_ETPU_QD_PRIM_SEC_INDEX,

                  FS_ETPU_PRIORITY_MIDDLE,

                  FS_ETPU_QD_CONFIGURATION_1,

                  FS_ETPU_TCR1,

                  0, 0, 0, 0, 0, 0, 0, 0,

                  FS_ETPU_QD_INDEX_PULSE_POSITIVE,

                  FS_ETPU_QD_INDEX_PC_NO_RESET,

                  FS_ETPU_QD_ETPU_A_TCR1_FREQ,

                  0);

// PERIODICALLY READ POSITION & DIRECTION 

Position = fs_etpu_qd_get_pc(0);

Direction = fs_etpu_qd_get_direction(0);

0 件の賞賛
返信