8052 port gives incorrect scheduler operation

barnacleboy2 wrote on Wednesday, July 09, 2008:

Hello,

I’m trying to port FreeRTOS to the Analog Devices ADuC847.  It’s a pretty standard 8052 core so I was hoping that once I had the vTaskStartScheduler function passing then the chip would burst into fully coherent life.

Below I have attached my main function and the only other modifications were removing SFRPAGE references in the port file and changing the timer register names.

When I run this the timer interrupt runs correctly (which is why I’m not posting the prvSetupTimerInterrupt changes) however the scheduler appears to completely ignore the TaskDelay function, toggling an output pin shows the function to enter and exit faster than the timer2 tick speed.

Internally the tick count even seems to be blocked by the uxSchedulerSuspended signal which is confusing my little non-embedded brain some.

I’m guessing there’s some sort of confusion in the scheduler: has anyone here seen such a problem?

Many Thanks

Adam

#include "FreeRTOS.h"
#include "task.h"

#define byte unsigned char

static void vLEDFlashTask( void * );

void main( void )
{
    vPortInitialiseBlocks();
    xTaskCreate( vLEDFlashTask, "LEDx", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL );
   
    vTaskStartScheduler();
}

static void vLEDFlashTask( void *pvParameters )
{
    (void) pvParameters;
    for(;:wink:
    {
        vTaskDelay( 100 );
        P0 &= ~(0x40);
        vTaskDelay( 100 );
        P0 |= 0x40;
    }
}

byte _sdcc_external_startup ( void )
{
    PSW &= ~(0x18); /* Register bank 0 */
    EA = 0;  /* Disable interrupts */
    CFG84x |= 0x01;  /* Extended stack diabled, Internal XRAM mapped to lower 2k of external address space */
    return 0;
}

woops_ wrote on Wednesday, July 09, 2008:

Is it possible that the 8051 is resetting over and over?

barnacleboy2 wrote on Wednesday, July 09, 2008:

No, I have some startup port signals in the real code which I don’t see making it off the chip.