# HCS12 timing

**URL:** <https://forums.freertos.org/t/hcs12-timing/3907>\
**Category:** Kernel\
**Created:** [October 26, 2005, 7:16pm UTC](https://forums.freertos.org/t/hcs12-timing/3907 "2005-10-26T19:16:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 26, 2005, 7:16pm UTC](https://forums.freertos.org/t/hcs12-timing/3907/1 "2005-10-26T19:16:40Z")

</div>

**[imajeff](https://sourceforge.net/u/imajeff/)** wrote on [Wednesday, October 26, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/ae4522fd/#9ef6):

I’m working more on the GCC/HCS12 port for MC9S12DP256. I think I’ve got the port ready to run the full demo as it works in the official CodeWarrior/HCS12 (banked) port. I have some questions about serial.

I have been testing with my own application which sends wireless packets through SCI at 9600 (actually 9615) baud. I am losing sync when reading the packets only when running with the RTOS.

I wonder if it is taking very long to switch tasks. Any Idea how long that takes in the CodeWarrior/HCS12 FreeRTOS port?

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [October 26, 2005, 7:30pm UTC](https://forums.freertos.org/t/hcs12-timing/3907/2 "2005-10-26T19:30:53Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Wednesday, October 26, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/ae4522fd/#9ef6/7f8f):

Naturally the RTOS will add an overhead to some extent.&nbsp; Conversely it can also be used to reduce the amount of time interrupts are disabled within your driver.

9600 baud should not be a problem, but is dependent on what else your application is doing.

Here are a couple of threads that might be of help:

[http://sourceforge.net/forum/message.php?msg\_id=3381733](http://sourceforge.net/forum/message.php?msg_id=3381733)  
[http://sourceforge.net/forum/message.php?msg\_id=3341669](http://sourceforge.net/forum/message.php?msg_id=3341669)

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 26, 2005, 8:52pm UTC](https://forums.freertos.org/t/hcs12-timing/3907/3 "2005-10-26T20:52:08Z")

</div>

**[imajeff](https://sourceforge.net/u/imajeff/)** wrote on [Wednesday, October 26, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/ae4522fd/#9ef6/04fe):

K, but one thing I’m certain of is that this GCC port will generate less optimized code, therefore taking longer than CW for the task swap. I have it ticking about 1 KHz. Perhaps I’ll scope it to find out what percent of that is typically the switch.

I am not using an interrupt, just to test this. I admit I haven’t put a check in there yet to see if the SCI input is overflowing, just guessing that’s happening 🙂

It’s hard with this GCC because I don’t have a source level debugger going yet.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 26, 2005, 8:59pm UTC](https://forums.freertos.org/t/hcs12-timing/3907/4 "2005-10-26T20:59:10Z")

</div>

**nobody** wrote on [Wednesday, October 26, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/ae4522fd/#9ef6/04fe/ebe8):

The saving and restoring of registers context is asm code so will be the same between cw and gcc.&nbsp; The switch C functions will be different but these are very small so hopefully not too different.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 26, 2005, 10:39pm UTC](https://forums.freertos.org/t/hcs12-timing/3907/5 "2005-10-26T22:39:53Z")

</div>

**[imajeff](https://sourceforge.net/u/imajeff/)** wrote on [Wednesday, October 26, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/ae4522fd/#9ef6/d2e1):

I know… I wrote it.&nbsp; I’m talking about the scheduler code which is C.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 1, 2005, 3:25pm UTC](https://forums.freertos.org/t/hcs12-timing/3907/6 "2005-12-01T15:25:51Z")

</div>

**[imajeff](https://sourceforge.net/u/imajeff/)** wrote on [Thursday, December 01, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/ae4522fd/#9ef6/b0ab):

I found that the timing wasn’t a significant problem durring task swapping.

Scope time for various task swaps in micro seconds:  
37, 12, 8

FreeRTOS tick interrupt looks steady at 1024 uS.
