2013-11-20

Intermittently SSEL failure bug found!

It took me almost 6 hours to find out why some SSEL work, and some don't, and some intermittently work.  The cause is that I mixed up my own initialization and write to port routines.  I should not have use confusing terms like "setup" and "set high".  I think I better use "write" and "read" port, and use setup for setting up and initialization. 

Nevertheless, the debugging is not a waste of time, because I took the opportunity to refactor my messy functions and printf() formats.  

// ***************************************************************************
// Main Function
// ***************************************************************************

int main()
{
initializeOutputPin01High(PortPinArrayP30);
initializeOutputPin01High(PortPinArrayP32);

blinkOneLed080(PortPinArrayP32, 500, 500, 2);
blinkOneLed080(PortPinArrayP30, 500, 500, 2);

uint8_t i;
for (i = 0; i < 100000; i++)
{
blinkOneLed080(PortPinArrayP30, 500, 500, 2);
blinkOneLed080(PortPinArrayP32, 500, 500, 2);
}

// blinkOneLed080(PortPinArrayP19, 1, 1, 500); // on 1mS, off 1mS, for 2 seconds


// blinkOneLed080(PortPinArrayP10, 1, 1, 50000); // on 1mS, off 1mS, for 100 seconds
// blinkOneLed080(PortPinArrayP10, 1, 1, 50000); // on 1mS, off 1mS, for 100 seconds

// blinkOneLed080(PortPinArraySsel06, 1, 1, 50000); // on 1mS, off 1mS, for 100 seconds

// testSpiLoopBack();
}

No comments:

Post a Comment