I think that this is by design according to Marshal | GHI Electronics , but it would help me do what I am trying to do. Is there any way around this?
I am still using 2.4.0.1000, so I don’t know - is it possible to make changes to DMA registers in RLP code?
My goal is to take what DigitalSignal.Generate is doing, but make it use circular DMA, so that with the timer (say TIM2 for PB3) modified to run in slave mode, I can have PB3 output the same waveform over and over again on the same external trigger. Does this make sense?
We can add a repeat mode by setting the timeout to -1 for an infinite duration. That would make things much easier for you, right?
I don’t think users can access the DMA registers—that’s by design.
Please let me know if I’ve understood your requirements correctly.
So setting the last element of the array to -1 would make the waveform repeat? Yes, I think that would be great!
No, adding -1 into the buffer doesn’t feel like the right approach.
Instead, we could add a repeatCount parameter to the Generate method:
public void Generate(uint[] data, uint offset, uint count, uint multiplier, GpioPinValue startingPolarity, int repeatCount)
repeatCount = 10 → Repeat the waveform 10 times.
Default value: 1 (run once).
repeatCount = -1 → Repeat forever until the user calls Abort() .
Does that sound good?
Yes, that sounds good. Thanks!
The hardest part is eliminating the gap between repetitions. Circular DMA would solve it, but things don’t always work as we thought.
We’ll keep you updated on our progress.
1 Like
Hi, it is already done.
repeatCount : 1 = once, N = N times, 0 = forever until Abort (not -1 as discussed)
1 Like
That’s great news! Thanks! How can I try it out?
It is the same as before; we just added one more parameter at the end: RepeatInfinite .
A simple example would be this: on the scope, you should see a 100KHz signal continuously if RepeatInfinite = 0 .
Let us know if you need anything else.
// Nanoseconds per buffer unit. 1000 = 1 us/unit, 500 = 500 ns/unit.
const uint Mult = 10000;
// repeatCount semantics: 1 = once, N = N times, 0 = forever until Abort.
const uint RepeatInfinite = 0;
static readonly uint[] SameBuf = { 1, 1, 1, 1, 1, 1, 1, 1,1,1 };
const int GENPIN = SC20260.Timer.DigitalSignal.Controller5.PA0;
var genPin = c.OpenPin(GENPIN);
var dsig = new DigitalSignal(genPin);
var dsig.OnGenerateFinished += (a,b) => { Console.WriteLine ("Finished")};
// test
dsig.Generate(SameBuf, 0, (uint)SameBuf.Length, Mult, GpioPinValue.High, RepeatInfinite);
Dat_Tran:
DigitalSignal
Sounds good, thanks! Is this available in the Signals library going forward? Starting with what version?
latest 3.0.1.6000 includes this feature. Try it and let us know if you need something else
1 Like