Transferring code from HC9S12DP512 to MC9S12XEP100

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Transferring code from HC9S12DP512 to MC9S12XEP100

Jump to solution
2,090 Views
danielflor
Contributor III

I'm transferring code from HC9S12DP512 to MC9S12XEP100. But there are some differences that I don't understand, even reading their datasheets.

Here is a code snippet, it is a configuration of a pin of the microcontroller as output compare:

 

 

ECT_TIOS  |= 0x10;                    /* Make channel an output compare  */
ECT_TC4    = ECT_TCNT + OSTickCnts;   /* Set TC4 to present time + OS_TICK_OC_CNTS */
ECT_TIE   |= 0x10;                    /* Enable OC4 interrupt */

 

 

With the above configuration the following lines of code work for HC9S12DP512 but not for MC9S12XEP100.

 

 

 BSET  PTT, #$010
 BCLR  PTT, #$010

 

 

So, I would like to know why on HC9S12DP512 the above lines work even with Output Compare enabled and on MC9S12XEP100 it doesn't. 

 

 

0 Kudos
1 Solution
2,067 Views
RadekS
NXP Employee
NXP Employee

Hi Danielflor,

minimum changes between ECT module on S12D and S12XE family, but one significant is still there.

 

On S12D, the direct output compare action on pin is defined by TCTL1/TCTL2 configuration. I can imagine case when you set no action on pin and drive the pin by GPIO in interrupt routine. Please confirm, whether this is your case.

 

On S12XE, the TCTL1/TCTL2 configuration works similar, but OLx,OMx=0 will not automatically enable GPIO functionality on a pin. You have to additionally set the appropriate bit in the new OCPD register for disconnection port T pin from ECT driving. After that, you may use OC4 channel and GPIO function on PT4 simultaneously.

 

I hope it helps you.

Best regards

Radek

View solution in original post

0 Kudos
4 Replies
2,068 Views
RadekS
NXP Employee
NXP Employee

Hi Danielflor,

minimum changes between ECT module on S12D and S12XE family, but one significant is still there.

 

On S12D, the direct output compare action on pin is defined by TCTL1/TCTL2 configuration. I can imagine case when you set no action on pin and drive the pin by GPIO in interrupt routine. Please confirm, whether this is your case.

 

On S12XE, the TCTL1/TCTL2 configuration works similar, but OLx,OMx=0 will not automatically enable GPIO functionality on a pin. You have to additionally set the appropriate bit in the new OCPD register for disconnection port T pin from ECT driving. After that, you may use OC4 channel and GPIO function on PT4 simultaneously.

 

I hope it helps you.

Best regards

Radek

0 Kudos
2,046 Views
danielflor
Contributor III

Hi @RadekS.


You got the key point.
I've set ECT_OCPD_OCPD4 = 0b1 and everything works like a charm now.
Thanks a lot

0 Kudos
2,078 Views
danielflor
Contributor III

I want to use Output Compare timer to generate tick for OS, but I have a device that is physically connected to pin PT4 and I would like to control it.
On the DP512, it is like this and when porting to the XEP100, the functionality that, in theory, had not changed, stopped working.

0 Kudos
2,083 Views
lama
NXP TechSupport
NXP TechSupport

Hi,
You are mixing two thing.

A periheral ECT and a GPIO function.

ECT as a peripheral can outomaticaly set/clear/togglo/do_nothing on output compare action if ECT peripheral is enabled at the pin. Moreover if the peripheral is enabled at he pin then it takes precedence over GPIO (the lowest alternative function of the pin)and also over all peripherals with lower prioritu connected to the pin. The priority of the alternative functions can be fond in the data sheet in the table (Table 1-10. Signal Properties Summary) which summarize functions for each pin. The priority of perihherals is from left to the right.

Another thing is set or cler pin in the GPIO function. BSET/BCLR (PTT_PTT4 = 1; PTT_PTT4 = 0;). Of course if the ECT is enabled at the pin the GPIO function is not connected to the pin. You are writin to the buffer but the buffer is disconnected from them pin because ECT takes precedence.

Now the question is what you want to do. Either toggle pin manually or generate output signal with automatic/manual action at the pin.

I believe a set of examples can help you... https://community.nxp.com/t5/S12-MagniV-Microcontrollers/LAMA-s-S12XE-unofficial-examples/ta-p/11007...

The examples are compatible in principle because they are written for the same family devices.

Best regards,
Ladislav