SCI  just works on DEBUGGING MODE

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

SCI  just works on DEBUGGING MODE

ソリューションへジャンプ
1,509件の閲覧回数
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;

}

ラベル(1)
0 件の賞賛
1 解決策
735件の閲覧回数
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 件の賞賛
4 返答(返信)
735件の閲覧回数
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 件の賞賛
736件の閲覧回数
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 件の賞賛
735件の閲覧回数
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 件の賞賛
735件の閲覧回数
Master_col
Contributor III

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

0 件の賞賛