xv4y 46 Posted September 27, 2012 Share Posted September 27, 2012 Hi, I think this is more related to the MSP430G2553 than to Energia but I want your opinion. I am a beginner with all of this so don't be surprised if my questions are stupids. For my project (a beacon generator with an RTC clock) I was using TimerSerial for debugging. I had no problem at all with it, always had good data coming from the LaunchPad. Then I decided to switch to Serial (the hardware UART) since TimerSerial was generating some delays and possibly making the RTC drift. Using a simple code (just a clock) with short strings sent every second, no problem. However, using Serial with my beacon code that generate a lot of text for debugging, the display was totally erratic. It seems that the hardware UART has a really small buffer and if I send too much data too often it get corrupted and then all the following strings are corrupted. Can someone confirm me this or is it something in my code ? It is not a big deal indeed since I can switch back to TimerSerial and this display is only for debug, but I would like to understand... Thanks for your help. Regards, Yannick. Quote Link to post Share on other sites
jsolarski-backup 22 Posted September 27, 2012 Share Posted September 27, 2012 Could you post your code? But it sounds like your sending data to fast to the buffer and overwriting what has not been sent. xv4y 1 Quote Link to post Share on other sites
energia 485 Posted September 27, 2012 Share Posted September 27, 2012 Welcome back xv4y! This sound like a bug somewhere in Energia. Can you please post the complete Sketch? Robert xv4y 1 Quote Link to post Share on other sites
xv4y 46 Posted September 29, 2012 Author Share Posted September 29, 2012 Hi friends, I could post the code but it is rather long and since the serial things are used only for debugging there is a lot of #IFDEF and it will not be really easy to read. I will try to post the interesting things anyhow. However, this is the weekend and I have kids at home until tuesday because it is Trung Thu (Moon day). Robert, if you'd like to try to compile the code I can send it to you via a private message. Thanks for your help! Yan. Quote Link to post Share on other sites
energia 485 Posted September 29, 2012 Share Posted September 29, 2012 Feel free to send me the code and I'll try to narrow it down. We can use this thread to further discuss. Quote Link to post Share on other sites
xv4y 46 Posted October 3, 2012 Author Share Posted October 3, 2012 Hi, Well, this is just to keep the community informed. We (in fact mainly Robert) are investigating the problem as it may be a bug in the Serial library. This could be related to a SRAM exhaustion. If you experience the same kind of anomaly, please report... Regards, Yannick. Quote Link to post Share on other sites
xv4y 46 Posted October 15, 2012 Author Share Posted October 15, 2012 Hi, The problem was all mine. I did a little rework of my code and saved a few bytes of SRAM. Now the program is running ok with Serial lib for hardware communications. It seems likely that the memory was exhausted and in some cases Serial could have been using too much SRAM for its buffers and getting corrupted characters. I will soon publish the code in my blog. Regards, Yan. --- http://xv4y.radioclub.asia/ Quote Link to post Share on other sites
energia 485 Posted October 15, 2012 Share Posted October 15, 2012 Thanks for the update Yan! If freeing up some RAM made it work then we were probably dealing with the stack growing into an area that was already occupied by preallocated variables aka stack overflow. RObert Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.