Hi,
I have FC7 Professional updated to the latest version 7.3.0.5 (19.12.2017).
The RTC component is version 2.0.
I use dsPIC33FJ128GP802 with internal oscillator (FRC) + PLL for CPU and an external crystal 32.768Khz attached to the SOSC pins for RTCC.
Below is a test program, which does not work for me.
The data and time is set as I want, but seems there are no clock, nothing changes.
I look at the data on PC with a serial monitor software using UART of the PIC and a TTL-USB converter.
Do I need to make more RTC register settings in a C code? If yes, what exactly?
I expected that all the necessary settings to take place automatically in Initialization Macro, but it seems not.
Could you please help to debug and find the problem?
P.S. Using the same hardware and code written with the CCS C compiler, everything works fine, and then we may assume there is a (missing) setting problem in Flowcode. Below is the C code used with CCS.
RTC component and dsPIC33FJ128GP802
-
- Posts: 190
- Joined: Mon Jul 07, 2014 9:38 am
- Has thanked: 30 times
- Been thanked: 77 times
- Contact:
Re: RTC component and dsPIC33FJ128GP802
The next C code placed instead of Initialize or before or after Initialize makes the RTC to run.
Unfortunately it jumps 7s - this is what I see on PC screen to each UART TX, which is not normal, beacus ein reality is max. 1s and something, under 2s.
Further debugging assistance is welcome.
Do I still need to apply the patches from here "Flowcode_7_Latest_240817.zip":
viewtopic.php?f=63&t=18760&p=83423&hilit=RTC#p83423
or is it enough that I downloaded and applied "Patch7.3.0.5.exe"?
Code: Select all
/* Enable the secondary oscillator for 32.768KHz crystal */
__builtin_write_OSCCONL(OSCCON |2);
/* enable write to the RTCC */
__builtin_write_RTCWEN();
_RTCEN = 1; /* enable the RTCC module */
_RTCPTR = 0b11; /* set the RTCC Value register window to Year */
RTCVAL = 0x0017; /* set year to xx17 */
RTCVAL = 0x1219; /* set Month = 12, Day = 19 */
RTCVAL = 0x0313; /* set Weekday = 3, Hour = 13 */
RTCVAL = 0x3400; /* set Minutes = 34, Seconds = 00 */
_RTCWREN = 0; /* lock the RTCC, no more writes */
Further debugging assistance is welcome.
Do I still need to apply the patches from here "Flowcode_7_Latest_240817.zip":
viewtopic.php?f=63&t=18760&p=83423&hilit=RTC#p83423
or is it enough that I downloaded and applied "Patch7.3.0.5.exe"?
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: RTC component and dsPIC33FJ128GP802
the patches from "Flowcode_7_Latest_240817.zip" will be older than the latest version 7.3.0.5 release