AnsweredAssumed Answered

MCF52259 time issue, and processing time

Question asked by Carl Norman on Aug 31, 2016
Latest reply on Sep 7, 2016 by Carl Norman

Hi,

 

I have done a simple test on my processor as I am having some issues with things taking to long.

 

so I have found each of my "real time" issues and made a very simple block of code with comments showing how long things take.

 

One obvious issue I can see is that _time_delay(1) to _time_delay(9) all end up taking 10mS.

 

The other concern is just how long its taking to dump data into a buffer to send.

 

The code is very simple with comments showing how long each thing takes. I measured this in my DSO.

 

//Priority 6 task, release BSP/PSP version with optimization

void SDI_Task(uint_32)
{
UINT8 i = 0;

Shell_IO = (pointer)fopen("ittya:", (pointer) (IO_SERIAL_RAW_IO));

reg_ptr->GPIO.DDRUC |= 0b00000100; //Force to output state
reg_ptr->GPIO.PORTUC &= (~0b00000100); //Force to output to low

//Test 1 All of these pulses are exactly 10mS! instead of 1, 2, 3, 4, 5, 6mS
reg_ptr->GPIO.PORTUC |= 0b00000100; //Force to output to high
_time_delay(1);
reg_ptr->GPIO.PORTUC &= (~0b00000100); //Force to output to low
_time_delay(1);
reg_ptr->GPIO.PORTUC |= 0b00000100; //Force to output to high
_time_delay(2);
reg_ptr->GPIO.PORTUC &= (~0b00000100); //Force to output to low _time_delay(1);
_time_delay(1);
reg_ptr->GPIO.PORTUC |= 0b00000100; //Force to output to high
_time_delay(3);
reg_ptr->GPIO.PORTUC &= (~0b00000100); //Force to output to low
_time_delay(1);
reg_ptr->GPIO.PORTUC |= 0b00000100; //Force to output to high
_time_delay(4);
reg_ptr->GPIO.PORTUC &= (~0b00000100); //Force to output to low
_time_delay(1);
reg_ptr->GPIO.PORTUC |= 0b00000100; //Force to output to high
_time_delay(5);
reg_ptr->GPIO.PORTUC &= (~0b00000100); //Force to output to low
_time_delay(1);
reg_ptr->GPIO.PORTUC |= 0b00000100; //Force to output to high
_time_delay(6);
reg_ptr->GPIO.PORTUC &= (~0b00000100); //Force to output to low

 

_time_delay(50); //This delay takes about 54mS

//Test 2 this takes ~815uS to "buffer" up ~90 chars. this processors bus is supposed to be running at 80Mhz, and 76MIPS, so about 65,200 bus clocks to buffer up 90 chars...
reg_ptr->GPIO.PORTUC |= 0b00000100; //Force to output to high
fprintf(Shell_IO, "starting this long test that should not take to long ay, because it should just continue\n");
reg_ptr->GPIO.PORTUC &= (~0b00000100); //Force to output to low

_time_delay(50);

//Test 3 this takes 7.8mS which is about right for transmitting 90 chars on 115200baud on ittya
reg_ptr->GPIO.PORTUC |= 0b00000100; //Force to output to high
fprintf(Shell_IO, "starting this long test that should not take to long ay, because it should just with ff \n");
fflush(Shell_IO);
reg_ptr->GPIO.PORTUC &= (~0b00000100); //Force to output to low

_time_delay(50);

//Test 4 This takes about 71.5mS to format and print around 1300 chars, so thats about 5.7 Million bus clocks... About 4400 clocks per char...
reg_ptr->GPIO.PORTUC |= 0b00000100; //Force to output to high
for(i = 0; i != 0xFF; ++i)
{
fprintf(Shell_IO, " 0x%02X", i);
}
fprintf(Shell_IO, "\n\n");
reg_ptr->GPIO.PORTUC &= (~0b00000100); //Force to output to low

_time_delay(50);

//Test 5 this takes about 112mS which is about right on for 1300 chars printed
reg_ptr->GPIO.PORTUC |= 0b00000100; //Force to output to high
for(i = 0; i != 0xFF; ++i)
{
fprintf(Shell_IO, " 0X%02X", i);
}
fprintf(Shell_IO, "\n\n");
fflush(Shell_IO);
reg_ptr->GPIO.PORTUC &= (~0b00000100); //Force to output to low

_task_block();
}

Outcomes