Hi everybody. I made a project with no MQX support and now I need to migrate to MQX, starting from RTC. I'm using the M52259demo board.
I built this project in MQX 3.5 and it was working fine. While debugging I could see the registers RTCGOCL = 0x2000 and RTCCR = 0x67 that were the values I used before introducing MQX in my project.
Then I updated from CW 7.1.2 to CW 7.2 and installed MQX 3.6 and this same project is not running anymore. Infact the register RTCGOCL is stuck to 0x0000 and RTCCR to 0x06 that are their reset values. I don't know how to access this registers and why they were set correctly in the previous MQX version (at least I noticed that).
I tried to write the register RTCGOCL through the function "__rtc_register_write" and getting the base address of the RTC registers. But I cannot access the RTCCR register so I should anyway find a correct value for RTCGOCH and RTCGOCL using the internal 80Mhz system frequency as clock, but I don't want to do that.
Here is my code. I get the time values through scanf function: first the days value then the time values as "hh.mm.ss" format.
#include <mqx.h>#include <bsp.h>#include "main.h"#include <rtc.h>#include <mcf52xx_rtc.h>#if !BSPCFG_ENABLE_IO_SUBSYSTEM#error This application requires BSPCFG_ENABLE_IO_SUBSYSTEM defined non-zero in user_config.h. Please recompile BSP with this option.#endif#ifndef BSP_DEFAULT_IO_CHANNEL_DEFINED#error This application requires BSP_DEFAULT_IO_CHANNEL to be not NULL. Please set corresponding BSPCFG_ENABLE_TTYx to non-zero in user_config.h and recompile BSP with this option.#endifvoid my_rtc_isr(void);TASK_TEMPLATE_STRUCT MQX_template_list[] = { /* Task number, Entry point, Stack, Pri, String, Auto? */ {MAIN_TASK, Main_task, 1500, 9, "main", MQX_AUTO_START_TASK}, {0, 0, 0, 0, 0, 0, }};RTC_TIME_STRUCT rtc_time;void Main_task(uint_32 initial_data){ uint_32 state; uint_32 days, hours, minutes, seconds; printf ("Benvenuti! \r\n"); printf ("Inserire giorno:\r\n"); scanf ("%d", &days); printf ("Inserire ora come hh.mm.ss:\r\n"); scanf ("%d.%d.%d", &hours, &minutes, &seconds); rtc_time.seconds = seconds; rtc_time.minutes = minutes; rtc_time.hours = hours; rtc_time.days = days; _rtc_set_time (&rtc_time); printf ("Inizializzazione RTC...\r\n"); if (MQX_OK != _rtc_init (RTC_INIT_FLAG_RESET | RTC_INIT_FLAG_ENABLE)) { printf ("Errore di inizializzazione\r\n"); } state = _rtc_int_enable (TRUE, MCF52XX_RTC_RTCIENR_1HZ); printf ("Nuovo stato interrupt: %d\r\n", state); printf ("Installazione ISR RTC...\r\n"); if (MQX_OK != _rtc_int_install (my_rtc_isr)) { printf ("Errore di installazione ISR\r\n"); } for(;;) { } _mqx_exit(0);}void my_rtc_isr(){ _rtc_get_time (&rtc_time); printf ("Sono le %d.%d.%d del giorno %d\r\n", rtc_time.hours, rtc_time.minutes, rtc_time.seconds, rtc_time.days); _rtc_clear_requests (MCF52XX_RTC_RTCISR_1HZ); }/* EOF */
Regards,
Marco.
解決済! 解決策の投稿を見る。
Maybe the BSPCFG_ENABLE_RTCDEV is not enabled.
In BSP file init_bsp.c, there's RTC being enabled including those registers you mentioned (_bsp_rtc_io_init() function).
Note to your code: you should first install and then enable the RTC interrupt.
PetrM
Maybe the BSPCFG_ENABLE_RTCDEV is not enabled.
In BSP file init_bsp.c, there's RTC being enabled including those registers you mentioned (_bsp_rtc_io_init() function).
Note to your code: you should first install and then enable the RTC interrupt.
PetrM
Hi, I'm working with the HCS12 and HCS12X series. I want to know, if possible to do one application with the MQX ussing this microcontrollers?. many thanks.
This family of devices is not on the roadmap for FSLMQX support.
Regards,
David
Thanks for your suggestion