Exchange AD samples between cogs
kgrgbg
Posts: 4
Hi,
I am totally new to Propeller programming and have the following thing to resolve:
sample sound with one cog and then apply a FFT with another cog and then displatch a series of WS2812 LED bytes with a 3rd COG.
I am about to base my program on the microphone to headphones sample delivered with the propeller tool which does the sampling in assembler.
As a first thing I am working on separating the sampling and the audio output which requires to move the data from one cog to another cog.
However, I am currently stuck with the question how I can forward any sampled data from the AD cog to the other one that would do processing on the data.
As far as I have understood the Propeller this is a hub action and would require to sync with the hub memory access window and this would mean that my audio sampling is interrupted for a short period of time.
So it seems to me that it does not make any sense to move every sample over to global RAM but fill a cog buffer with some audio, maybe 512 bytes and then batch move that to the hub.
But still my sampling would get interrupted for a bunch of cycles.
Is there any DMA thing that would transfer in the background?
Thanks and regards,
Conny
I am totally new to Propeller programming and have the following thing to resolve:
sample sound with one cog and then apply a FFT with another cog and then displatch a series of WS2812 LED bytes with a 3rd COG.
I am about to base my program on the microphone to headphones sample delivered with the propeller tool which does the sampling in assembler.
As a first thing I am working on separating the sampling and the audio output which requires to move the data from one cog to another cog.
However, I am currently stuck with the question how I can forward any sampled data from the AD cog to the other one that would do processing on the data.
As far as I have understood the Propeller this is a hub action and would require to sync with the hub memory access window and this would mean that my audio sampling is interrupted for a short period of time.
So it seems to me that it does not make any sense to move every sample over to global RAM but fill a cog buffer with some audio, maybe 512 bytes and then batch move that to the hub.
But still my sampling would get interrupted for a bunch of cycles.
Is there any DMA thing that would transfer in the background?
Thanks and regards,
Conny
Comments
Ok, not moving the data does make total sense to me.
Does that mean if I apply a lock I can access that memory area of the hub any time?
Then I could have to buffers in the hub RAM for my sampler and always fill one (with lock), the other one being read by the other cog processing the data?
that doesn't exactly answer my question.
The key concern I have is that there is a delay due to the hub sync when transferring the data to to the "consumer" cog.
When sending each samples byte I will hardly be able to keep my sample rate. When batch transferring the data to the global ram I have an interruption in my sampling for the time I am transferring the data. Suppose the sync is the smaller issue in the latter case.
I am even thinking about the idea to use the IO pins to transfer each byte to another cog - producer cog sets 8 or 12 GPIOs accordingly, plus one that signals new data, consumer cog polls the signal line and reads the value.
Pretty hacky, though. Is there any shared registers or something I could use for the same thing?
Regards,
Conny
So I should be able to add the storing of one sample to global RAM into the waiting for the next sample time.
I could do my transfer of the value to global RAM before the WAITCNT instruction and should then be fine.