chipKIT® Development Platform

Inspired by Arduino™

chipkit will get struck when i read from the serial port

Created Thu, 29 Sep 2011 14:22:13 +0000 by nikhil


Thu, 29 Sep 2011 14:22:13 +0000

hi In my project i am getting data from serial port but initially when program starts it will work fine... but as the time passes and program will get more data which i am saving in an String. So before saving it to String the chipkit is hanging up...

i think this is because of memory leakage i am not sure... please help me to solve this issue... and if some one knows how to flush the stored memory and how to allocate more memory will be helpful


Thu, 29 Sep 2011 17:53:07 +0000

With out posting the code, or at least a much better description of your code, there's not much help that can be offered.


Fri, 30 Sep 2011 13:01:46 +0000

hi thanks for your reply here is my code to read from the Serial port-2 String getDetails() { delay(100); String Temp=""; if(Serial2.available()>0) { int val=Serial2.available(); boolean got=false; while(val>0) { int; Serial.print(_val,BYTE); Temp=Temp+(char)_val; val=Serial2.available(); ;

return Temp;

} }

here whenever i read, if the data is small means around 30 char's then it woks fine but when the data length goes behind 100 or so the controller get hanged ..

and one more thing is that it will read the huge data for 1-3 times after that while reading the data only the microcontroller will be hanged.... i think its hanging because of memory leak or lake of memory space or serial buffer over flow... what do u say.... ? please suggest some solution... _ The same code is working fine with Atmel2560 arduino platform but not in chipkit max32_