*** assertion failed: 0, file serial_api.c, line 115 ------------Anyone know what this means?

04 Jul 2011

I get this error anytime I try to use the 4DGL library... Updated the firmware on the mbed, updated the mbed library, updated the 4DGL library... Using the simplest config possible..... The program compiles with no errors...

The error message appears on putty which I am using as a serial terminal on the pc...

Any other program I try that uses the same mbed library on the same mbed, connected the same way, etc... works fine...no errors while trying to communicate...The error appears on the terminal, the program halts and nothing else happens...no doubling blinking leds, no nothing...halt... hit reset, the error appears again and it halts...

Am I totally missing something obvious? I'd really like to get past this and use the library... =)

(I put this under bugs/suggestions due to the fact that the error mentions the file serial_api.c line 115......which sounds to me like it's talking about the mbed side...??

04 Jul 2011

Hi Mark,

That sounds to me like the 4DGL library you are using/have written is misbehaving somehow, as that is an internal assertion failure in Serial suggesting that the mbed Serial library can't perform the action requested (based on the underlying UART mapping not being known).

Perhaps the 4DGLis somehow doing something on something uninitialised, or something is stomping on memory?

Simon

04 Jul 2011

Hi Simon, thanks for the quick reply!

I suppose that makes sense.. I imagine if the mbed api was having trouble, the message wouldn't make it to the terminal very well... ;) Weird that it does this for me, but everywhere I looked nobody else seems to have experienced the issue... Which I'd own up to if I was doing something weird....but I'm using a very vanilla config.. And haven't modified the library or it's example..

Not even sure where to begin, the library is pretty involved.. =/

mark

04 Jul 2011

Maybe another set of eyes would help? Can you share out your project or are you just trying to run a stock code example that you can point us to?

05 Jul 2011

Pretty stock setup...

  • Mbed on a regular breadboard (using usb for power (actually I've tried it off the 5v regulator too.)
  • 4DGL SGC display http://www.4dsystems.com.au/prod.php?id=113
  • Pin 9 on mbed to RX on display
  • pin 10 on mbed to TX on display
  • pin 11 on mbed to reset on display
  • display power to 5v regulator and common ground

Nothing else to speak of...no ethernet connected, etc... The serial data with the above mentioned error message is sent via usb to putty on my windows7 machine.. I've tried XP as well and a couple other terminal programs, but the received serial message is not corrupt on any of them..the link seems fine...as I am also able to use other programs and communicate with the mbed perfectly.

The library is from the cookbook... http://mbed.org/cookbook/4D-SGC-TFT-Screen Looks well written, obviously tested by many others.. I haven't modified the code, and am using the provided example.. I did update the firmware in the mbed and updated the mbed library as well....

As I mentioned, I am able to load other programs onto the same mbed unit, use serial with no problems whatsoever.. Communication in both directions works great.

I might also mention that I am able to write my own program and communicate bi-directionally with the display and change background colors, etc. successfully... I'd just really like to simplify it with this library...

Thanks!

08 Jul 2011

I don't have a 4DGL screen to test things out with but I might be able to add some instrumentation to the code to figure out what is happening if you want some help.

To start with, I took the demo pointed to by the cookbook link you gave above and pulled it into the my workspace. It is now published here:

edit: Test program removed.

If you import this into your workspace, does it reproduce the problem? If it does then I can try adding some instrumentation to get more information when the problem happens.

05 Jul 2011

Actually I tried running that demo code I linked to above on my mbed with no 4DGL device attached and it died with the same assert for me. I added a printf() to the beginning of the program and it was never hit so it looks like this error is occurring in the constructor of the 4DGL object. I looked through that code and there were a few places where the code reads back data from the device into a buffer and never checks for buffer overflow but even after I fixed those issues, I am still seeing the same problem. Moving the object construction into the main() function gets rid of the assert but I do still see a bunch of garbage dumped to the terminal. Later today, I will look at it some more.

08 Jul 2011

Mark, I have updated the demo in my workspace with a few corrections and have published it. Can you give it a try with the actual device to see if it works better for you?

Import library4DGL

Fixed a few minor issues in 4DGL library Moved pc serial port object used for debug output into 4DGL object itself. Previously it was a global object but its constructor wasn't getting run before the global constructor for the 4DGL object itself which led to an assert in the serial code. I also fixed a few potential buffer overruns that I saw in the code as well.

edit: Removed test program and just point to the modified library instead.

06 Jul 2011

Hi Adam, Sorry it took so long to reply...

That worked perfectly the first time! Very cool! The output on the serial terminal all looks good, the display shows several colored shapes, some test strings and a grey background!!

Thanks so much! One question, I cannot seem to figure out how to enable or disable the debug mode...?? I'm sure I'm missing something... But I really want to use the other serial ports as well as the usbserial for my application and when I tie the other ports to stuff it seems to reaaally slow everything down...(I'm guessing because the debug is dumping so much out the the usb serial..)..

Anyway, great job and thanks for the quick help!!

06 Jul 2011

Cool. I will ping Stephane to see if he can pick up the changes and release a new version of the library. I would prefer to not create a fork.

06 Jul 2011

Understood! Thanks again.. I put a blurb edit in my previous post... at the same time you responded.. ;)

06 Jul 2011

I should note that it only slows when I am dumb and kept the Serial pc(USBTX, USBRX); line in my program.... =/

Edit: Ok, figured out how to switch the debug off... I'm golden... Thanks again!!!!!!!!!!!!!!!!!!!!!!

06 Jul 2011

Hello,

I am sorry I did not reply on this subject earlier but I have too much work at this time and do not have spare time any more. I will not be able to do any work on mbed for many months so feel free to update the cookbook and the lib as needed, so no fork will be created. I have absolutely no problem with that. The lib could be better with some serial heritage class but as an old C programmer, I did not know how to do it.

So upgrade it, make it better and publish it and get rid of my old version.

Cheers,

Stephane.

06 Jul 2011

Thanks for the reply Stephane.. I think the library works great actually, just needed some minor tweaks and I've been able to do some pretty cool stuff since my last post... So I'm very happy! It's much appreciated for the contribution and I'm sure it'll serve many others as well!

It's this kind of stuff that makes the mbed so great!!! Thanks guys!!!!!!!!!!!!!!!!!!!!

(I hope to contribute to this degree when I can....might take some more experience.... ;) )