Fix a bug between PAD and FSEL which disturb other GPIO
This commit is contained in:
parent
288ff2299c
commit
62259b6c75
5 changed files with 24 additions and 18 deletions
|
@ -26,7 +26,7 @@ This program is free software: you can redistribute it and/or modify
|
||||||
clkgpio::SetAdvancedPllMode(true);
|
clkgpio::SetAdvancedPllMode(true);
|
||||||
clkgpio::SetCenterFrequency(TuneFrequency,SymbolRate); // Write Mult Int and Frac : FixMe carrier is already there
|
clkgpio::SetCenterFrequency(TuneFrequency,SymbolRate); // Write Mult Int and Frac : FixMe carrier is already there
|
||||||
clkgpio::SetFrequency(0);
|
clkgpio::SetFrequency(0);
|
||||||
|
disableclk(4);
|
||||||
syncwithpwm=false;
|
syncwithpwm=false;
|
||||||
|
|
||||||
if(syncwithpwm)
|
if(syncwithpwm)
|
||||||
|
@ -40,12 +40,14 @@ This program is free software: you can redistribute it and/or modify
|
||||||
pcmgpio::SetFrequency(SymbolRate);
|
pcmgpio::SetFrequency(SymbolRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Should be obligatory place before setdmaalgo
|
||||||
|
Originfsel=clkgpio::gengpio.gpioreg[GPFSEL0];
|
||||||
|
dbg_printf(1,"FSK Origin fsel %x\n",Originfsel);
|
||||||
|
|
||||||
SetDmaAlgo();
|
SetDmaAlgo();
|
||||||
|
|
||||||
padgpio pad;
|
|
||||||
Originfsel=pad.gpioreg[PADS_GPIO_0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fskburst::~fskburst()
|
fskburst::~fskburst()
|
||||||
|
@ -54,8 +56,9 @@ This program is free software: you can redistribute it and/or modify
|
||||||
|
|
||||||
void fskburst::SetDmaAlgo()
|
void fskburst::SetDmaAlgo()
|
||||||
{
|
{
|
||||||
sampletab[buffersize*registerbysample-2]=(Originfsel & ~(7 << 12)) | (4 << 12); //Enable Clk
|
|
||||||
sampletab[buffersize*registerbysample-1]=(Originfsel & ~(7 << 12)) | (0 << 12); //Disable Clk
|
sampletab[buffersize*registerbysample-2]=(Originfsel & ~(7 << 12)) | (4 << 12); //Gpio Clk
|
||||||
|
sampletab[buffersize*registerbysample-1]=(Originfsel & ~(7 << 12)) | (0 << 12); //Gpio In
|
||||||
|
|
||||||
dma_cb_t *cbp = cbarray;
|
dma_cb_t *cbp = cbarray;
|
||||||
// We must fill the FIFO (PWM or PCM) to be Synchronized from start
|
// We must fill the FIFO (PWM or PCM) to be Synchronized from start
|
||||||
|
@ -86,11 +89,12 @@ This program is free software: you can redistribute it and/or modify
|
||||||
|
|
||||||
}
|
}
|
||||||
lastcbp=cbp;
|
lastcbp=cbp;
|
||||||
|
|
||||||
SetEasyCB(cbp,buffersize*registerbysample-1,dma_fsel,1);//Disable clk
|
SetEasyCB(cbp,buffersize*registerbysample-1,dma_fsel,1);//Disable clk
|
||||||
|
|
||||||
cbp->next = 0; // Stop DMA
|
cbp->next = 0; // Stop DMA
|
||||||
|
|
||||||
//dbg_printf(1,"Last cbp : src %x dest %x next %x\n",cbp->src,cbp->dst,cbp->next);
|
dbg_printf(2,"Last cbp : src %x dest %x next %x\n",cbp->src,cbp->dst,cbp->next);
|
||||||
}
|
}
|
||||||
void fskburst::SetSymbols(unsigned char *Symbols,uint32_t Size)
|
void fskburst::SetSymbols(unsigned char *Symbols,uint32_t Size)
|
||||||
{
|
{
|
||||||
|
@ -112,9 +116,11 @@ This program is free software: you can redistribute it and/or modify
|
||||||
dma::start();
|
dma::start();
|
||||||
while(isrunning()) //Block function : return until sent completely signal
|
while(isrunning()) //Block function : return until sent completely signal
|
||||||
{
|
{
|
||||||
|
//dbg_printf(1,"GPIO %x\n",clkgpio::gengpio.gpioreg[GPFSEL0]);
|
||||||
usleep(100);
|
usleep(100);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
dbg_printf(1,"FSK burst end Tx\n",cbp->src,cbp->dst,cbp->next);
|
||||||
usleep(100);//To be sure last symbol Tx ?
|
usleep(100);//To be sure last symbol Tx ?
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,8 +173,8 @@ int clkgpio::SetFrequency(double Frequency)
|
||||||
uint32_t FreqDivider = (uint32_t)Freqresult;
|
uint32_t FreqDivider = (uint32_t)Freqresult;
|
||||||
uint32_t FreqFractionnal = (uint32_t)(4096 * (Freqresult - (double)FreqDivider));
|
uint32_t FreqFractionnal = (uint32_t)(4096 * (Freqresult - (double)FreqDivider));
|
||||||
if ((FreqDivider > 4096) || (FreqDivider < 2))
|
if ((FreqDivider > 4096) || (FreqDivider < 2))
|
||||||
dbg_printf(1, "Frequency out of range\n");
|
dbg_printf(0, "Frequency out of range\n");
|
||||||
printf("DIV/FRAC %u/%u \n", FreqDivider, FreqFractionnal);
|
dbg_printf(1,"DIV/FRAC %u/%u \n", FreqDivider, FreqFractionnal);
|
||||||
|
|
||||||
SetClkDivFrac(FreqDivider, FreqFractionnal);
|
SetClkDivFrac(FreqDivider, FreqFractionnal);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ This program is free software: you can redistribute it and/or modify
|
||||||
#include "iqdmasync.h"
|
#include "iqdmasync.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
iqdmasync::iqdmasync(uint64_t TuneFrequency,uint32_t SR,int Channel,uint32_t FifoSize,int Mode):bufferdma(Channel,FifoSize,4,3)
|
iqdmasync::iqdmasync(uint64_t TuneFrequency,uint32_t SR,int Channel,uint32_t FifoSize,int Mode):bufferdma(Channel,FifoSize,4,3)
|
||||||
{
|
{
|
||||||
|
@ -51,8 +51,7 @@ iqdmasync::iqdmasync(uint64_t TuneFrequency,uint32_t SR,int Channel,uint32_t Fif
|
||||||
|
|
||||||
mydsp.samplerate=SampleRate;
|
mydsp.samplerate=SampleRate;
|
||||||
|
|
||||||
padgpio pad;
|
Originfsel=clkgpio::gengpio.gpioreg[GPFSEL0];
|
||||||
Originfsel=pad.gpioreg[PADS_GPIO_0];
|
|
||||||
|
|
||||||
SetDmaAlgo();
|
SetDmaAlgo();
|
||||||
|
|
||||||
|
@ -65,8 +64,7 @@ iqdmasync::iqdmasync(uint64_t TuneFrequency,uint32_t SR,int Channel,uint32_t Fif
|
||||||
|
|
||||||
iqdmasync::~iqdmasync()
|
iqdmasync::~iqdmasync()
|
||||||
{
|
{
|
||||||
padgpio pad;
|
clkgpio::gengpio.gpioreg[GPFSEL0]=Originfsel;
|
||||||
pad.gpioreg[PADS_GPIO_0]=Originfsel;
|
|
||||||
clkgpio::disableclk(4);
|
clkgpio::disableclk(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,3 +27,4 @@ This program is free software: you can redistribute it and/or modify
|
||||||
#include "dsp.h"
|
#include "dsp.h"
|
||||||
#include "ookburst.h"
|
#include "ookburst.h"
|
||||||
#include "atv.h"
|
#include "atv.h"
|
||||||
|
#include "util.h"
|
|
@ -18,6 +18,7 @@ This program is free software: you can redistribute it and/or modify
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "ookburst.h"
|
#include "ookburst.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
|
||||||
ookburst::ookburst(uint64_t TuneFrequency,uint32_t SymbolRate,int Channel,uint32_t FifoSize):bufferdma(Channel,FifoSize+2,2,1)
|
ookburst::ookburst(uint64_t TuneFrequency,uint32_t SymbolRate,int Channel,uint32_t FifoSize):bufferdma(Channel,FifoSize+2,2,1)
|
||||||
|
@ -42,11 +43,11 @@ This program is free software: you can redistribute it and/or modify
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Originfsel=clkgpio::gengpio.gpioreg[GPFSEL0];
|
||||||
SetDmaAlgo();
|
SetDmaAlgo();
|
||||||
|
|
||||||
padgpio pad;
|
|
||||||
Originfsel=pad.gpioreg[PADS_GPIO_0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ookburst::~ookburst()
|
ookburst::~ookburst()
|
||||||
|
|
Loading…
Reference in a new issue