Project - More Complete G120 Custom Watchdog + RLP

I just posted More Complete G120 Custom Watchdog + RLP on Codeshare. Feel free to discuss and make suggestions here.

How far can we take the native C coding? Can we include regular C header files? Can we open/close files on an SD card that was mounted in the managed environment?

Any reference to the supported part of C in the native environment or its limitations will be greatly appreciated.


It is not meant to do any of that. Think about it, runtime loadable procedures RLP

But you can take it anyway you like, even load an operating system!

I know it wasn’t meant to do any of that… But a lot of great discoveries weren’t meant to be either.

In my case, I know what I want to do and I’ll just keep trying… Edison is my mentor.

Thanks for your time.

Hi Gus,

I did not want to say the following at first until I had a chance to see if I can do it on my own.

On one hand in post #2, you are telling me that RLP is not meant to do what I want to do; but on the other hand, in the following post #3 you came back and said that RLP is so ‘powerful’, I can even load an OS! I wasn’t sure if you were serious about it but I took it seriously. Don’t these two statements contradict each other?

Anyway, after I reviewed the source code of NETMF and your non premium open source extension to NETMF ( specifically RLP Lite). I have done this review to the best of my capability in the limited time I have left before I lose the contract of the project I am currently working on and interest in NETMF all together. I noticed that many routines are written in C and there is a chance to call them in RLP if I can manage to pass the needed info (pointers to functions and necessary parameters) to RLP native side. But the thing is the libraries are so convoluted, it will most likely take me weeks if not months to figure out how to so it on my own.

I really need your help, you or another experienced colleague can probably answer my question in a minute. Please have a closer look at what I am trying to do in the explanation of my recent post mentioned in first post herein. And let me know.

If we can achieve this, which I am willing to share with the community, it will add a level of robustness to our applications: Close all open files and flush data to the SD card or any other permanent storage right before WDT resets the system if and when NETMF code freezes in order to prevent files corruption.

Your attention to this matter is greatly appreciated.


I forgot to mention the infrequent freezes I am trying to deal with in a serious G120HDR implementation that involves data logging into a local SQLite database and transmitting the the same to a central DB on the web (actually Xively at the moment).

I have no memory leaks, if someone is tempted to ask. And the system freezes at random times! Sometimes it runs for hours and sometimes it freezes after 30 mins!

WDT will come to the rescue when completed, but I am hoping to eventually find the source of frequent freezes! WDT will just buy me time until then.


The forum is not the right way to engage GHI formally. Jump on their website, and look for their contact details, and go crazy. They have a consulting service and will help if they can and if you engage them correctly. Expecting commercial level support through an online forum won’t end well I’m afraid

1 Like

Thanks Brett,

To give GHI rightful credit, browsing through more than a hundred forum posts, I saw several GHI employees solving some serious issues. And let’s not forget the other generous community members, who solved and contributed numerous valuable solutions.

I did notice, however, that some issues were left hanging! Maybe I am one of those unlucky guys?!

I’ll wait another day or two and see how it goes.

Then I’ll have no choice but to follow your advice, which I really appreciate.

Best Regards,


I honestly think your level of question is too detailed for the forum, may require something “special” for you, so you’ll need to engage them - plus it seemed from the earlier post that the house was on fire, so calling in the GHI Fire Dept seemed the logical next step to do, immediately. Remember, the more time you give the experts before it becomes a life/death (of your product, your job, your sanity etc) the better.

You could just have a dodgy system that has a hardware issue. My thought is that you’re currently using WDT in “disguise my problem” mode and you need to get to the bottom of that. There is either something very special about your code (that few if any other people have hit) or something external is influencing it. There haven’t really been a plethora of issues like this that I can recall, and if it is a hardware issue then you’re unlikely to have any recourse within RLP or NETMF to correct for that - no amount of investigation can assist.

I’d call them today and figure out how you get the right engagement process happening.

@ Sambo - i have been in a number off situations where i was blaming NETMF or GHI’s premium lib’s (and there is room for improvement) but at the end of (most) cases i would find the source (or work around) in my own coding.

It’s important to understand NETMF is a subset from .NET that’s is not as stable as you would expect BUT if you get your apps running AND test everything as you should THEN this platform is really reliable!

Hey Brett,

Man you are truly a legend! I just paid attention to your Rank and your 74,560 earned points! I also read your profile/background.

I liked your humble Software Experience: “Basic experience. I can blink an LED.”!

It’s an honor to get an advice from you sir!

Concerning dealing with the possibility of a hardware issue that you mentioned, I can assure you with high confidence that my freezing problem of the NETMF environment is not hardware related - have had lots of hardware design and troubleshooting experience and an M.S. in EECE, but I continue to learn even from the students whom I used to teach!

I verified with a high certainty that when the managed NETMF code freezes, the RLP code (interrupt handler for the WDT Warning (ISR) and a timer handler that flashes an LED) continues to run. There is a minute possibility that the code residing in flash memory is getting corrupted but the system wouldn’t rerun correctly after reset if that’s the case: My code always works after reset and it’s repetitive with no user interactions whatsoever!

Faulty RAM could cause something like this (RLP is so small; the little RAM it uses could be working fine). However, from past experience, when a programmed system has an erratic fault, I blame the software 99.999% of the time before I blame the hardware. Most hardware problems are consistent or permanent and can be exacerbated with added heat (a hair dryer does wonders!). Loose connections and bad solder joints are the culprit in most erratic problems. I flex the cables and the PCB and knock gently on different components. I also checked the regulated supply voltages for stability, accuracy, and noise on a digital scope. Again UC is not locking up, LED continues to flash by RLP code.

Bottom line, I concur with you: the only way to be 100% sure that the lock up is not hardware related is to test my software/firmware on a different hardware, which was previously tested, possibly with some serious diagnostic software, and known to be very robust.

Last but not the least, you and others might wonder why I am so anxious to get my WDT warning to perform a graceful shutdown in RLP. First of all, I refuse to rely on WDT in a “disguise my problem” mode as you mentioned; but I am glad that NETMF is currently freezing frequently enough in order to thoroughly test WDT graceful shutdown effectiveness without me having to simulate unlikely lock up scenarios. The main reason for the need of an advanced WDT functionality with graceful shutdown before resetting the system is that we all know embedded systems will eventually lock up and that’s why hardware engineers invented WDTs in UCs. Although I mentioned this in a previous post, I’ll repeat it since it’s important: the problem of conventional WDTs is that they abruptly reset the system and if you have opened files they will most likely get corrupted, especially on flash type memory with cache enabled to reduce the number of write cycles. Many guys complained about this problem on this Forum (e.g., ). The system I am currently designing will hopefully be distributed to hundreds of spread out, hard to reach locations. What can one do to revive/restart those units that will eventually lock-up/freeze?

I’m planning to contact GHI directly, tomorrow morning, as you suggested. Hopefully, they can assist in resolving this issue.



Thanks bunch for your feedback.

My short version response:

What you said is true. I perfectly understand what you said and agree with you.

I already typed and saved a long version response, definitely not directed at you but at NETMF. However, I decided to sleep on it before I posted it! I might change my mind and not post it!

Speaking of typing and saving what anybody wants to post on this Forum, I lost what I typed in this Forum for stupid reasons on a few occasions. One time I typed a whole page in a codeshare Form and when I clicked submit an error occurred and I lost everything! I clicked go back and the darned browser gave me an empty form! So I learned my lesson to type anything I want to post, longer than a few lines, in any browser page/form in a separate editor with English correction and do what we, programmers, are good at: ‘CTRL+S’ every line! I also installed ‘M8 Clipboard’, which I like, to save several captures of ‘CTRL+C’.