SCI  just works on DEBUGGING MODE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SCI  just works on DEBUGGING MODE

Jump to solution
1,476 Views
Master_col
Contributor III

Hi everyone , and thanks for your time.

 

Well my problem is that i receive data on SCI on debugging mode perfectly, but when i re-power my target the NF(noise Flag) from SCIS1 sets and i receive a bad data. 

 

This confuse me a lot cause in debugging mode works ok, but i power off and then on my target and this problem happens. This is how i initialize my SCI:

 

 

void init_SCI(void){
                      
           SCIBDH=0;
           SCIBDL=52;     // 9600 bps para 8MHz            
           SCIC2_RE=1;    // Rx enable
           SCIC2_TE=1;    // Tx enable
           SCIC2_RIE=1;   // interrupt rx enable
           SCIS1;              // clear flag        
           SCID;
}

 

 

 

I just generate an interrupt when a data is ready on Rx.

 

This is my Interrupt rutine for Rx:

 

 

interrupt 17 void ISR_SCI_RX(void){

 

           // tilt_led();

                          // Si hay Noise Flag

            if(SCIS1_NF==1){

 

                PTAD_PTAD1=1;// avisa por led

                SCIS1;   // limipa bandera de NF

                SCID;    // 

                goto out_SCI; 

 

            } else{ PTAD_PTAD1=0;

            }

            SCIS1;

            RS232_data=SCID;    // read data      

 

 

            SCID=RS232_data;

            while(!SCIS1_TDRE); // wait sent           

 

           out_SCI:

            asm NOP;

}

Labels (1)
0 Kudos
1 Solution
702 Views
Master_col
Contributor III

Well i have found it. May be is a stupid mistake of mine but if someone gets this error this is the solution. 

By default the Trim Register  has a value of 0x80 (for QG8) but when in debugging mode the value is altered to 0xA8 and this is the velocity to work on. So what you have to do is just modify this value to 0xA8 on ICSTRM register.

 

Thank you for your time and excuse my poor english.

View solution in original post

0 Kudos
4 Replies
702 Views
Master_col
Contributor III

I have found that when in debug mode the clock of the MCU its normal but after RE POWER the target (no debug) the source clock is a bit faster why it could be this? am i missing something? this is my initializacion for the QG8:

 

 

  

 

 ICSC2_BDIV=0; //  8MHz clk      

SOPT1_COPE=0; // DISABLE watchdog      

asm RSP

 

0 Kudos
703 Views
Master_col
Contributor III

Well i have found it. May be is a stupid mistake of mine but if someone gets this error this is the solution. 

By default the Trim Register  has a value of 0x80 (for QG8) but when in debugging mode the value is altered to 0xA8 and this is the velocity to work on. So what you have to do is just modify this value to 0xA8 on ICSTRM register.

 

Thank you for your time and excuse my poor english.

0 Kudos
702 Views
bigmac
Specialist III

Hello,

 

Are you programming the device using P&E USB Multilink Interface?  Do you calibrate the trim value during this process?

 

Your initialisation code should then explicitly transfer the NVTRIM value stored within flash, into the TRIM register.  Note that there will likely be considerable unit to unit variation of the required trim value to produce the specific bus frequency.  Therefore trim calibration should always be done during programming, when you utilize the internal clock reference.

 

Regards,

Mac

 

0 Kudos
702 Views
Master_col
Contributor III

yes thank you, that's what i didn't know i think it was auto calibrated. =)

0 Kudos