# problems porting FreeRTOS on AVR atmega328p

**URL:** <https://forums.freertos.org/t/problems-porting-freertos-on-avr-atmega328p/595>\
**Category:** Kernel\
**Created:** [October 21, 2009, 10:32pm UTC](https://forums.freertos.org/t/problems-porting-freertos-on-avr-atmega328p/595 "2009-10-21T22:32:38Z")\
**Posts on this page:** 12\
**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 21, 2009, 10:32pm UTC](https://forums.freertos.org/t/problems-porting-freertos-on-avr-atmega328p/595/1 "2009-10-21T22:32:38Z")

</div>

**anonymous** wrote on [Wednesday, October 21, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/16976871/#5dab):

I’M trying to get my first run with FreeRTOS on AVR chips.  
I have an atmega328p, which is very similar to atmega323. I’m testing on the stk500v2 board.  
According to the documentation, I’m making small changes in port.c, resume with a diff :  
`diff ./Source/portable/GCC/ATMega323/port.c …  
416c416  
&lt; ucLowByte = TIMSK;  
&gt; ucLowByte = TIMSK1;  
418c418  
&lt; TIMSK = ucLowByte;  
&gt; TIMSK1 = ucLowByte;`  
I see some errors in the test code due to serial port differences, so I change some ref :  
`103c103  
&lt; ucByte = UCSRB;  
&gt; ucByte = UCSR0B;  
105c105  
&lt; UCSRB = ucByte;  
&gt; UCSR0B = ucByte;  
113c113  
&lt; ucInByte = UCSRB;  
&gt; ucInByte = UCSR0B;  
115c115  
&lt; UCSRB = ucInByte;  
&gt; UCSR0B = ucInByte;  
136c136  
&lt; UBRRL = ucByte;  
&gt; UBRR0L = ucByte;  
140c140  
&lt; UBRRH = ucByte;  
&gt; UBRR0H = ucByte;  
144c144  
&lt; UCSRB = ( serRX\_INT\_ENABLE | serRX\_ENABLE | serTX\_ENABLE );  
&gt; UCSR0B = ( serRX\_INT\_ENABLE | serRX\_ENABLE | serTX\_ENABLE );  
147c147  
&lt; UCSRC = ( serUCSRC\_SELECT | serEIGHT\_DATA\_BITS );  
&gt; UCSR0C = ( serUCSRC\_SELECT | serEIGHT\_DATA\_BITS );  
206c206  
&lt; ucByte = UCSRB;  
&gt; ucByte = UCSR0B;  
208c208  
&lt; UCSRB = ucByte;  
&gt; UCSR0B = ucByte;  
222c222  
&lt; cChar = UDR;  
&gt; cChar = UDR0;  
240c240  
&lt; UDR = cChar;  
&gt; UDR0 = cChar;`  
After that, I can compile the demo :  
`Size after:  
rtosdemo.elf&nbsp; :  
section&nbsp;&nbsp;&nbsp;&nbsp; size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; addr  
.data&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 80&nbsp;&nbsp; 8388864  
.text&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 9880&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0  
.bss&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1665&nbsp;&nbsp; 8388944  
.stab&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 32016&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0  
.stabstr&nbsp;&nbsp; 15741&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0  
Total&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 59382  
Errors: none  
----- end -----`  
But after uploading the code, It doesn’t work… no led flashing or signal on serial port.  
Does anyone experiencing such problem? I don’t see what other difference between m323/3328 I have to code.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 21, 2009, 10:35pm UTC](https://forums.freertos.org/t/problems-porting-freertos-on-avr-atmega328p/595/2 "2009-10-21T22:35:16Z")

</div>

**anonymous** wrote on [Wednesday, October 21, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/16976871/#0ffb):

oups… sorry for the &quot;code&quot; section

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 22, 2009, 12:56am UTC](https://forums.freertos.org/t/problems-porting-freertos-on-avr-atmega328p/595/3 "2009-10-22T00:56:39Z")

</div>

**[edwards3](https://sourceforge.net/u/edwards3/)** wrote on [Thursday, October 22, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/16976871/#c523):

I cannot read the posted code, but can you say some more about what happens when you try running the application? How far does the code get?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 22, 2009, 7:41pm UTC](https://forums.freertos.org/t/problems-porting-freertos-on-avr-atmega328p/595/4 "2009-10-22T19:41:50Z")

</div>

**anonymous** wrote on [Thursday, October 22, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/16976871/#a97e):

## Here is the FreeRTOS/Source/portable/GCC/ATMega323/port.c diff 416c416 &lt; ucLowByte = TIMSK;

## &gt; ucLowByte = TIMSK1; 418c418 &lt; TIMSK = ucLowByte;

&gt; TIMSK1 = ucLowByte;

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 22, 2009, 7:51pm UTC](https://forums.freertos.org/t/problems-porting-freertos-on-avr-atmega328p/595/5 "2009-10-22T19:51:32Z")

</div>

**anonymous** wrote on [Thursday, October 22, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/16976871/#6643):

FreeRTOS/Source/portable/GCC/ATMega323/port.c  
&nbsp;&nbsp;&nbsp; 416c416  
&nbsp;&nbsp;&nbsp; &amp;lt; ucLowByte = TIMSK;  
&nbsp;&nbsp;&nbsp; –  
&nbsp;&nbsp;&nbsp; $gt; ucLowByte = TIMSK1;  
&nbsp;&nbsp;&nbsp; 418c418  
&nbsp;&nbsp;&nbsp; &amp;lt; TIMSK = ucLowByte;  
&nbsp;&nbsp;&nbsp; –  
&nbsp;&nbsp;&nbsp; &amp;gt; TIMSK1 = ucLowByte;

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 22, 2009, 8:02pm UTC](https://forums.freertos.org/t/problems-porting-freertos-on-avr-atmega328p/595/6 "2009-10-22T20:02:27Z")

</div>

**anonymous** wrote on [Thursday, October 22, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/16976871/#c6d8):

`  
FreeRTOS/Source/portable/GCC/ATMega323/port.c&nbsp;  
416c416&nbsp;  
&lt; ucLowByte = TIMSK;&nbsp;  
–&nbsp;  
&gt; ucLowByte = TIMSK1;&nbsp;  
418c418&nbsp;  
&lt; TIMSK = ucLowByte;&nbsp;  
–&nbsp;  
&gt; TIMSK1 = ucLowByte;&nbsp;  
`

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 22, 2009, 8:04pm UTC](https://forums.freertos.org/t/problems-porting-freertos-on-avr-atmega328p/595/7 "2009-10-22T20:04:26Z")

</div>

**anonymous** wrote on [Thursday, October 22, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/16976871/#4268):

FreeRTOS/Source/portable/GCC/ATMega323/port.c :&nbsp;  
&nbsp;&nbsp;&nbsp; 416c416&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; ucLowByte = TIMSK;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; ucLowByte = TIMSK1;&nbsp;  
&nbsp;&nbsp;&nbsp; 418c418&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; TIMSK = ucLowByte;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; TIMSK1 = ucLowByte;&nbsp;

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 22, 2009, 8:16pm UTC](https://forums.freertos.org/t/problems-porting-freertos-on-avr-atmega328p/595/8 "2009-10-22T20:16:08Z")

</div>

**anonymous** wrote on [Thursday, October 22, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/16976871/#d6d8):

Sorry for the post I’m not good with the post language.&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;  
At the end, the port.c and serial.c mod to compile the demo for atmega328.  
When I re-start after program the chip, nothing is happend, no led flashing, no data on serial spare port…&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;  
FreeRTOS/Source/portable/GCC/ATMega323/port.c :&nbsp;  
&nbsp;&nbsp;&nbsp; 416c416&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; ucLowByte = TIMSK;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; ucLowByte = TIMSK1;&nbsp;  
&nbsp;&nbsp;&nbsp; 418c418&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; TIMSK = ucLowByte;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; TIMSK1 = ucLowByte;&nbsp;  
&nbsp;&nbsp;&nbsp;  
FreeRTOS/Demo/AVR\_ATMega323\_WinAVR/serial/serial.c :  
103c103  
&nbsp;&nbsp;&nbsp; &lt; ucByte = UCSRB;  
&nbsp;&nbsp;&nbsp; &gt; ucByte = UCSR0B;  
&nbsp;&nbsp;&nbsp; 105c105  
&nbsp;&nbsp;&nbsp; &lt; UCSRB = ucByte;  
&nbsp;&nbsp;&nbsp; &gt; UCSR0B = ucByte;  
&nbsp;&nbsp;&nbsp; 113c113  
&nbsp;&nbsp;&nbsp; &lt; ucInByte = UCSRB;  
&nbsp;&nbsp;&nbsp; &gt; ucInByte = UCSR0B;  
&nbsp;&nbsp;&nbsp; 115c115  
&nbsp;&nbsp;&nbsp; &lt; UCSRB = ucInByte;  
&nbsp;&nbsp;&nbsp; &gt; UCSR0B = ucInByte;  
&nbsp;&nbsp;&nbsp; 136c136  
&nbsp;&nbsp;&nbsp; &lt; UBRRL = ucByte;  
&nbsp;&nbsp;&nbsp; &gt; UBRR0L = ucByte;  
&nbsp;&nbsp;&nbsp; 140c140  
&nbsp;&nbsp;&nbsp; &lt; UBRRH = ucByte;  
&nbsp;&nbsp;&nbsp; &gt; UBRR0H = ucByte;  
&nbsp;&nbsp;&nbsp; 144c144  
&nbsp;&nbsp;&nbsp; &lt; UCSRB = ( serRX\_INT\_ENABLE | serRX\_ENABLE | serTX\_ENABLE );  
&nbsp;&nbsp;&nbsp; &gt; UCSR0B = ( serRX\_INT\_ENABLE | serRX\_ENABLE | serTX\_ENABLE );  
&nbsp;&nbsp;&nbsp; 147c147  
&nbsp;&nbsp;&nbsp; &lt; UCSRC = ( serUCSRC\_SELECT | serEIGHT\_DATA\_BITS );  
&nbsp;&nbsp;&nbsp; &gt; UCSR0C = ( serUCSRC\_SELECT | serEIGHT\_DATA\_BITS );  
&nbsp;&nbsp;&nbsp; 206c206  
&nbsp;&nbsp;&nbsp; &lt; ucByte = UCSRB;  
&nbsp;&nbsp;&nbsp; &gt; ucByte = UCSR0B;  
&nbsp;&nbsp;&nbsp; 208c208  
&nbsp;&nbsp;&nbsp; &lt; UCSRB = ucByte;  
&nbsp;&nbsp;&nbsp; &gt; UCSR0B = ucByte;  
&nbsp;&nbsp;&nbsp; 222c222  
&nbsp;&nbsp;&nbsp; &lt; cChar = UDR;  
&nbsp;&nbsp;&nbsp; &gt; cChar = UDR0;  
&nbsp;&nbsp;&nbsp; 240c240  
&nbsp;&nbsp;&nbsp; &lt; UDR = cChar;  
&nbsp;&nbsp;&nbsp; &gt; UDR0 = cChar;

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 22, 2009, 8:17pm UTC](https://forums.freertos.org/t/problems-porting-freertos-on-avr-atmega328p/595/9 "2009-10-22T20:17:37Z")

</div>

**anonymous** wrote on [Thursday, October 22, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/16976871/#7597):

Sorry for the post I’m not good with the post language.&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;  
At the end, the port.c and serial.c mod to compile the demo for atmega328.  
When I re-start after program the chip, nothing is happend, no led flashing, no data on serial spare port…&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;  
FreeRTOS/Source/portable/GCC/ATMega323/port.c :&nbsp;  
&nbsp;&nbsp;&nbsp; 416c416&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; ucLowByte = TIMSK;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; ucLowByte = TIMSK1;&nbsp;  
&nbsp;&nbsp;&nbsp; 418c418&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; TIMSK = ucLowByte;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; TIMSK1 = ucLowByte;&nbsp;  
&nbsp;&nbsp;&nbsp;  
FreeRTOS/Demo/AVR\_ATMega323\_WinAVR/serial/serial.c :&nbsp;  
103c103&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; ucByte = UCSRB;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; ucByte = UCSR0B;&nbsp;  
&nbsp;&nbsp;&nbsp; 105c105&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; UCSRB = ucByte;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; UCSR0B = ucByte;&nbsp;  
&nbsp;&nbsp;&nbsp; 113c113&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; ucInByte = UCSRB;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; ucInByte = UCSR0B;&nbsp;  
&nbsp;&nbsp;&nbsp; 115c115&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; UCSRB = ucInByte;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; UCSR0B = ucInByte;&nbsp;  
&nbsp;&nbsp;&nbsp; 136c136&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; UBRRL = ucByte;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; UBRR0L = ucByte;&nbsp;  
&nbsp;&nbsp;&nbsp; 140c140&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; UBRRH = ucByte;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; UBRR0H = ucByte;&nbsp;  
&nbsp;&nbsp;&nbsp; 144c144&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; UCSRB = ( serRX\_INT\_ENABLE | serRX\_ENABLE | serTX\_ENABLE );&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; UCSR0B = ( serRX\_INT\_ENABLE | serRX\_ENABLE | serTX\_ENABLE );&nbsp;  
&nbsp;&nbsp;&nbsp; 147c147&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; UCSRC = ( serUCSRC\_SELECT | serEIGHT\_DATA\_BITS );&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; UCSR0C = ( serUCSRC\_SELECT | serEIGHT\_DATA\_BITS );&nbsp;  
&nbsp;&nbsp;&nbsp; 206c206&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; ucByte = UCSRB;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; ucByte = UCSR0B;&nbsp;  
&nbsp;&nbsp;&nbsp; 208c208&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; UCSRB = ucByte;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; UCSR0B = ucByte;&nbsp;  
&nbsp;&nbsp;&nbsp; 222c222&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; cChar = UDR;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; cChar = UDR0;&nbsp;  
&nbsp;&nbsp;&nbsp; 240c240&nbsp;  
&nbsp;&nbsp;&nbsp; &lt; UDR = cChar;&nbsp;  
&nbsp;&nbsp;&nbsp; &gt; UDR0 = cChar;&nbsp;  
&nbsp;

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 22, 2009, 9:44pm UTC](https://forums.freertos.org/t/problems-porting-freertos-on-avr-atmega328p/595/10 "2009-10-22T21:44:25Z")

</div>

**anonymous** wrote on [Thursday, October 22, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/16976871/#70f4):

I just try with an another AVR, atmega32. I just change the makefile parameters, and it works (3 blinking leds + 2 serial port transmission leds) ! So I can exclude a problem on the stk500 and harware config.

I recheck the atmega328 spec, but I don’t fine where the problem come from.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 24, 2009, 12:30am UTC](https://forums.freertos.org/t/problems-porting-freertos-on-avr-atmega328p/595/11 "2009-10-24T00:30:03Z")

</div>

**[kd5uwl](https://sourceforge.net/u/kd5uwl/)** wrote on [Saturday, October 24, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/16976871/#e9fa):

Did you check these items at the top of port.c:

&nbsp;&nbsp;&nbsp; /\* Hardware constants for timer 1. \*/  
&nbsp;&nbsp;&nbsp; #define portCLEAR\_COUNTER\_ON\_MATCH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( ( unsigned portCHAR ) 0x08 )  
&nbsp;&nbsp;&nbsp; #define portPRESCALE\_64&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( ( unsigned portCHAR ) 0x03 )  
&nbsp;&nbsp;&nbsp; #define portCLOCK\_PRESCALER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( ( unsigned portLONG ) 64 )  
&nbsp;&nbsp;&nbsp; #define portCOMPARE\_MATCH\_A\_INTERRUPT\_ENABLE&nbsp;&nbsp;&nbsp; ( ( unsigned portCHAR ) 0x02 )

These are what worked on my 1284p.&nbsp; Point is, you may need to check these.&nbsp; I don’t know that this is right, just something else to check.

kd5uwl

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 25, 2009, 11:00pm UTC](https://forums.freertos.org/t/problems-porting-freertos-on-avr-atmega328p/595/12 "2009-10-25T23:00:28Z")

</div>

**anonymous** wrote on [Sunday, October 25, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/16976871/#b546):

That’s right, the interrupt comparator enable bit is not the same. And the interrupt vector name is not same. The final &quot;port.c&quot; is here. There is also problems with the serial port, but with the relevant tasks commented in main.c, it works.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
diff -r FreeRTOS/Source/portable/GCC/ATMega323/port.c …&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
80c80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&lt; #define portCOMPARE\_MATCH\_A\_INTERRUPT\_ENABLE ( ( unsigned char ) 0x10 )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&gt; #define portCOMPARE\_MATCH\_A\_INTERRUPT\_ENABLE ( ( unsigned char ) 0x02 )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
416c416&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&lt; ucLowByte = TIMSK;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&gt; ucLowByte = TIMSK1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
418c418&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&lt; TIMSK = ucLowByte;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&gt; TIMSK1 = ucLowByte;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
429,430c429,430&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&lt; void SIG\_OUTPUT\_COMPARE1A( void ) \_\_attribute\_\_ ( ( signal, naked ) );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&lt; void SIG\_OUTPUT\_COMPARE1A( void )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&gt; void TIMER1\_COMPA\_vect( void ) \_\_attribute\_\_ ( ( signal, naked ) );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&gt; void TIMER1\_COMPA\_vect( void )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
