This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Bootloader OTP through SCI-B

Hi all:

With your help i was able to run custom bootloader from SARAM memory H0. I'm working with the standard bootloader removing unnecessary parts from it so that it would look like the example from the spraaq3 document.

I have the following problem: when the AutobaudLock is executing the

    while(SCIARegs.SCIFFCT.bit.ABD != 1) {}

is running for awhile then causes DSP to reset.  Should I run this example from the flash not just from the SARAM under simulator? 

The function is listed below. I have added the SCIARegs.SCIFFCT.bit.ABDCLR = 1; line as per erratum.

Thanks,

Yvon.

inline void SCIA_AutobaudLock()
{
    ui16 byteData;

    // Must prime baud register with >= 1
    SCIARegs.SCILBAUD = 1;
   
    // Prepare for autobaud detection
    // Set the CDC bit to enable autobaud detection
    // and clear the ABD bit     
    SCIARegs.SCIFFCT.all = 0x2000;
 SCIARegs.SCIFFCT.bit.ABDCLR = 1;
   
    // Wait until we correctly read an
    // 'A' or 'a' and lock   
    while(SCIARegs.SCIFFCT.bit.ABD != 1) {}

    // After autobaud lock, clear the CDC bit
    SCIARegs.SCIFFCT.bit.CDC = 0;

#if K1
    // for K1 we have to grab an extra byte out of the
    // buffer.  This is not required on F2810/12

    while( (byteData = SCIARegs.SCIRXBUF.bit.RXDT) != 'A');
    SCIARegs.SCITXBUF = byteData;
#endif   

#if F2812 | F2810
    while(SCIARegs.SCIRXST.bit.RXRDY != 1) { }
    byteData = SCIARegs.SCIRXBUF.bit.RXDT;
    SCIARegs.SCITXBUF = byteData;
#endif

    return;  
}

 

  • Thanks.

    This works when run from the flash. For some reason I could not make it work from SARAM.

    Thanks,

    Yvon

  • When I programmed the OTP memory the custom bootloader stopped working with the same problem.

    As soon as it reaches the

     while(SCIBRegs.SCIFFCT.bit.ABD != 1) line, trying to autolock

    the F2812 will reboot after a few cycles.

    Any ideas?

    Thanks,

    Yvon.

  •  While I have little experience in bootloaders and this error seems awfully strange I think I can see a way around it. 

    Since you say it fails on RAM and OTP and succeeds on Flash, this may be a timing issue as Flash is considerably slower than RAM and OTP on the F2812.  I have a feeling that the reset is being somehow caused by reading the bit/register too fast or too often (I may be wrong but it just looks this way).  As a workaround I suggest you use the following code:

    while (SCIBRegs.SCIFFCT.bit.ABD != 1)

     {

    asm("  NOP");

    asm("  NOP");

    asm("  NOP");

    asm("  NOP");

    asm("  NOP");

    }

    and see how that goes in RAM and OTP. Hope it helps!

    Thanks

     

    Tim

  • Hi Tim:

    Thanks for the reply. I will try NOPs . I have tried to use the Delay_US() function. This did not help.

     

    Thanks,

    Yvon.