Using a Freescale DSP chip, I have 3 timers that grab a value out of an their own respective LUT to generate a sine wave (often with many harmonics) and then send the information out to a DAC. The system is controlled over a serial interface by a GUI (which I am am also designing).
I send the information defining the amplitude of each of the harmonics and then generate the sine LUT's for the outputs.
I ran into a problem where every so often when I send new data the sine LUT has some corrupted data in it. After poking around, I noticed that if I turned off the timers when I was updating the sine LUT, it worked flawlessly (other than seeing the sine wave stop updating sometimes while the timers are off).
So clearly the problem is that I am accessing the data at the same time I am updating this. I don't know why this is. I figured that with a processor, with code running serially, this wouldn't happen.
I was just wondering what the proper way to do this is. I figured that I could have two LUTs, update one while reading from the other and then just switching a pointer at the end. But I am slightly concerned about memory size and I feel like this complicates my communications interface.
Anyone have any suggestions?