This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP-EXP430FR5969: Displayed values seem to drift down the screen

Part Number: MSP-EXP430FR5969
Other Parts Discussed in Thread: BOOSTXL-SHARP128

Hello E2E Experts,

Good day.

I'm working with an MSP-EXP430FR5969 Launch Pad with a BOOSTXL-SHARP128 LCD attached.  I bring in an analog waveform (an ECG, for whatever it's worth), run that through the ADC12 on board A / D Converter, then display the waveform on the SHARP128 LCD.  The analog ECG waveform is sampled at 256 Hz and every 4 samples are displayed in order to fit about 2 seconds of waveform on the 128 pixel wide display.  I'm saving 30 seconds worth of data (7680 values) into FRAM to be sent to an external device via JSON communications.  I'm also controlling some LED lights that are attached to certain output ports on the MSP430.  I also start by showing a Loyola University logo on the screen.  As the waveform is being input and displayed, I'm also calculating the heart rate of the waveform and displaying that on the screen.

This means that I'm running multiple pieces of TI code all pulled together into a single executable:

  • GPIO code to run the LED lights;
  • ADC12 code to run the A/D Converter;
  • GRLIB code to display the logo and to put the text on the screen;
  • Timer code to time the 256 Hz sampling rate to the ADC;
  • JSON communication code to handle the JSON communication with the external device.

I have moved all of my "global" variables into FRAM to try to reduce the amount of RAM being used.  I've also tried increasing the heap size (I'm currently at 384) and the stack size (I'm currently at 180).  Not sure that those necessarily help though.  When everything is in the code, the Build tells me that I'm using 38596 FRAM and 1830 RAM.  

For legacy purposes, the display is used "upside down" so you'll notice that the "top" of the display is actually the bottom.  That is, the "top" is the edge closest to the ribbon connector.  Long story, but that's what it is.  So the origin is in the top, left corner of the "right side up" display - and in the bottom, right corner of the display as seen in the pictures.

I've attached two JPEG pictures. 

Image.zip

Beginning Waveform.jpg shows the waveform when it's first being display.  Notice that the "baseline" of the waveform is roughly 1/4 of the way "up" the screen - slightly above the "GND" label on the "right" of the screen.  Over time, the waveform tends to drift "up" the screen, EVEN THOUGH THE DISPLAY VALUES ARE NOT DRIFTING UP.  Over time, the waveform starts to look like that in the Later Waveform.jpg picture. Most of the display uses function GrLineDrawV to draw a vertical line from the previous ADC output value to the current value to get the appearance of a contiguous waveform.  I have used the Debugger to check the X and Y values actually being sent to the GrLineDrawV function to display on the screen and for both waveform instances they are in the same range.  But for some reason the GRLIB function "walks" the displayed values "up" the screen (increases Y).  

The really interesting thing is that if I just comment out the function call to initialize the JSON component, the code size drops to 36154 RAM and 1738 RAM.  Plus the waveform doesn't seem to "walk up the screen".  I'm not sure that it doesn't happen at all, but the "walk" is definitely delayed.  With the JSON code in the build, the "walk" happens within the first 5 minutes.  Without the JSON code, I've run for 20 minutes with only a slight drift up of the waveform.  It's still drifting up, but significantly slower.

The only thing I can figure is that there's some kind of heap or stack overflow or something else along those lines that ends up affecting the GRLIB code or the display buffer or something.  Increasing the heap and stack sizes seems to help, but it doesn't fix the problem.

Any ideas on things to try would be really appreciated!  How big can I make the heap and stack?  What else might be causing this to happen?  I'm not saying that there aren't any errors in my code that might be causing this, but I sure don't know what that would be and I really have no ideas on what to do to find the problem.

BTW - before I moved the "global" variables into FRAM, the waveform wouldn't display at all if I had the JSON init code in there.  The code seemed to be called - it just didn't actually display anything.  Taking out the JSON init code led to the waveform being displayed.  Likewise, moving all the "globals" to FRAM also led to the waveform being displayed even with the JSON code in there.  So it sure seems to be something to do with the overall size of the code.

Thank you in advance.

Regards,

CSC

**Attention** This is a public forum