Stand alone run mode not matching debug session

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

Stand alone run mode not matching debug session

819 Views
therealfreegeek
Contributor IV

Board - FRDMK64

KSDK - 1.3

KDS - 3 with all the updates

 

Problem - It looks like my RTC "seconds" interrupt is not happening or is not being serviced when running stand alone but is working perfectly in debug mode.

 

I have created a simple project to demonstrate. I have added USBCDC and the Debug console so that PRINTF is sent over the K64 USB on the FRDM board.

 

The main code is;


DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, DEBUG_UART_BAUD,
kDebugConsoleUSBCDC);

PRINTF("Hello world \r\n");

 

int i = 0;

for(;;){

     if (second_tick == 1 ){

     PRINTF("%d\r\n", i);

     second_tick = 0;

     i++;

     }

}

 

and the interrupt handler is;

 

void RTC_Seconds_IRQHandler(void)

{

       second_tick = 1;

}

 

The project prints as expected on the K64 USB when running from the debugger but when running stand alone only prints "Hello world", then nothing, as if the RTC seconds interrupt is not happening.

 

I posted this over on the KDS area when I thought I was not creating the "release" code properly but now think that this is not the issue.

 

Please have a look at the attached project and let me know if you also see the problem.

 

Here is the video - https://youtu.be/VHVjMFmxWNU

Original Attachment has been moved to: Muon_counter.zip

Labels (1)
0 Kudos
7 Replies

549 Views
DavidS
NXP Employee
NXP Employee

Hi Jim,

Nice video.  Thank you for posting.  Project helpful too.

Please ensure J25 jumpers pins 2-3 and not 1-2 for your test.

I can get your project to work if I plug in the USB cable, let it enumerate with PC, then press SW1/Reset button, and after enumeration open terminal window.

But I also do see your issue that from POR and emueration, I enable the terminal and only see hello world and not one second RTC interrupts.  Will ask around and also hope others have comments.

Regards,

David

0 Kudos

549 Views
therealfreegeek
Contributor IV

Hi Dave,

Thanks for having a look at this, the jumper will be in the default position, I will check on that tomorrow when I am back in the office, and will also try out the sequence you tried.

Thanks

Jim

0 Kudos

549 Views
DavidS
NXP Employee
NXP Employee

Hi Jim,

I found a workaround and added the code into main.c.

I also added a GPIO Component so I could use LED's on the FRDM-K64F Freedom board to help debugging.

Let me know how it works for you.

I will inquire around to determine if this is an errata or software issue.

Regards,

David

0 Kudos

549 Views
therealfreegeek
Contributor IV

Hi Dave, yes the jumper was on 2-3, and the operation was the same as you observed if I added the debug usb cable and used the reset switch.

Thanks for looking into this and finding the work around, it will be interesting to establish the root cause as you say, s/w issue or errata.

Thanks

Jim

0 Kudos

549 Views
therealfreegeek
Contributor IV

Hi Dave, I tried your code and it worked, I then spotted some odd behaviour.

I commented out this, which I thought was just there for test,

//#if 1 //DES 1=test, 0=default code

//    j++;

//    if(!(j%(0x80000))) {

//    printf("0x%X \r\n", (unsigned int)RTC_CR);

//    }

//#endif

.....and found that in debug, only "hello world" was printed and not the incrementing value, but that it worked as expected in stand alone mode.

I also commented out your code for toggling the LEDs and the led still toggled, now scratching my head.

Jim

0 Kudos

549 Views
DavidS
NXP Employee
NXP Employee

Hi Jim,

Yes I did modify the code to help my debugging and figured best to leave that with comments so if you want, you keep, if you don't then comment out or delete.

LoL with the toggling LED.  Sorry about that.  In PE for the pin_init:PinSettings Component you can enable the RTC_CLKOUT on PTE26/LEDRGB_GREEN.

Default config

pastedImage_0.png

Modified config:

pastedImage_1.png

To clear the setting I highlighted it and then used "Delete" key followed by "Enter/Return" key.

Regards,

David

0 Kudos

549 Views
therealfreegeek
Contributor IV

Hi Dave,

I spent some more time on this today and found another work around.

First I disabled all the auto initialisation in PE, I then added this code after the PE low level init.

rtc_datetime_t datetime;
datetime.
year = 2016;
datetime.
month = 01;
datetime.
day = 27;
datetime.
hour = 20;
datetime.
minute = 49;
datetime.
second = 30;


RTC_DRV_SetDatetime(0, &datetime);

RTC_DRV_Init(rtcTimer1_IDX);   

RTC_DRV_SetSecsIntCmd(rtcTimer1_IDX, 1);

This worked in both stand alone and debug mode.

I tried moving the "RTC_DRV_SetDatetime" line after the  "RTC_DRV_SetSecsIntCmd", and just before also but neither option worked in stand alone mode. I don't really understand why they need to be in this order but it seems to overcome the problem. I have attached an updated project, unfortunately with the same name, so far I have not had any success renaming projects.

Cheers

Jim

0 Kudos