Using the ATmega323 port for AT90s8515

Hi,  I’m a weird issue after porting to the AT90s8515.  I have only modified portTOTAL_HEAP_SIZE ((set to 384) and portCOMPARE_MATCH_A_INTERRUPT_ENABLE (set to 0x40) from the ATmega323 port, to match the 8515 device. All seems to work well when I just have one simple task that toggles a LED every 100mS.  When I add another task to flash another LED using the same code (albiet in a new function) the first task seems works at an accelerated rate and the second task appears to execute once and then halts (only debugging by the LED’s).  I’m using the vTaskDelayUntil function to delay the task.  All my variables are local to each function. Any idea’s? I have been

Using the ATmega323 port for AT90s8515

Do you have any external RAM?  I don’t think the 8515 has enough internal RAM.  384 heap size is probably your problem.  I suspect creating the second task is running out of ram.

Using the ATmega323 port for AT90s8515

I thought that may be the case but I have changed the portMINIMAL_STACK_SIZE from the original size (85) down to 30 and still the same issue.  The 8515 has 512bytes Ram,  a quick count means even with the Stack Size of 100 I should be able to fit three, even four tasks,  if not using any global variables.

Using the ATmega323 port for AT90s8515

30 bytes of stack is unfortunately not enough to save the AVR context – so you will get stack corruption for sure.