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:
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;
}
解決済! 解決策の投稿を見る。
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.
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
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.
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
yes thank you, that's what i didn't know i think it was auto calibrated. =)