| View previous topic :: View next topic |
| Author |
Message |
Sabeen Zameer
Joined: 12 Feb 2008 Posts: 10
|
Posted: Mon Aug 04, 2008 8:22 pm Post subject: Issues regarding Snap Application and the libraries it uses. |
|
|
Hello
I am using Snap application which i have converted to VC8. BSS files are supposed to be used to change sampling frequency before stream start, but in the StartStreaming function it again sets the sampling frequency by passing it the PLLOutput frequency which again sets the M and N factor. Therfore sampling frequency remains 43.2MH even if we change it through script commands.
secondly, i try to modify malibu libraries, but does'nt allow the changes to occur, and while debugging it says "Source code not available for the current location".
kindly help me out in these problems.
i hope for an appropriate response soon.
Sabeen Zameer |
|
| Back to top |
|
 |
jhenderson Site Admin
Joined: 07 Mar 2006 Posts: 1178 Location: So. Cal. USA
|
Posted: Tue Aug 05, 2008 10:10 am Post subject: Script processing |
|
|
Processing of the Start command occurs within PacketStream::Start() within PacketStram_Mb.cpp, as shown below:
| Code: | //---------------------------------------------------------------------------
// PacketStream::Start() -- Start busmastering
//---------------------------------------------------------------------------
void PacketStream::Start()
{
if (Started)
return;
OpenWire::NotifyEvent e;
OnBeforeStart.Execute(e);
XmitQ.Clear();
RecvQ.Clear();
RecvThread->Clear();
//
// Start Receiver Thread
RecvThread->Start();
XmitThread->Start();
StreamDevice->Reset();
//
// Initial Device Configuration
StreamDevice->Internals()->ConfigureBusmastering();
//
// Transmit Prefill
Prefill();
// StreamDevice->Log(0xC0, 0);
//
// Load Xmit Busmaster Region
StreamDevice->Internals()->PreloadXmitBusmasterRegion();
// This flag must be set before starting the busmaster.
Started = true;
//
// Start busmastering
StreamDevice->Internals()->StartBusmastering();
OnAfterStart.Execute(e);
}
|
The call to StreamDevice->Internals()->StartBusmastering() near the end of this function is implemented within PacketDeviceMap_Mb.cpp as
| Code: | //---------------------------------------------------------------------------
// PacketDeviceMap::StartBusmastering()
//---------------------------------------------------------------------------
void PacketDeviceMap::StartBusmastering()
{
// Stream Event Callback
OpenWire::NotifyEvent e;
OnBeforeStreamStart.Execute(e);
EnableBusmasterInterrupt(true);
if (ShouldIssueRcvCredit)
{
// ...Grant credit for part of Queue
unsigned int RcvRegionSize = BusMasterSizeWords()/2;
GrantCredit(PacketDevMap::PciInData, RcvRegionSize-5); // give a 'leetle' less than full region
}
//
// Begin full duplex busmastering
PacketDevice->BusmasteringOn();
// Stream Event Callback
OnAfterStreamStart.Execute(e);
} |
As you can seem the OnBeforeStreamStart event is called immediately prior to enabling bus-master transfers, whereas the OnAfterStreamStart is called immediately afterwards. The handlers for these two events within the DigitalReceiverDeviceMap_Mb.cpp are as follows:
| Code: | //---------------------------------------------------------------------------
// DigitalReceiverDeviceMap::OnBeforeStreamStartHandler()
//---------------------------------------------------------------------------
void DigitalReceiverDeviceMap::OnBeforeStreamStartHandler(OpenWire::NotifyEvent & Event)
{
// Forward notify to baseboard handler
Owner->OnBeforeStreamStart.Execute(Event);
// ...Start
UserFpgaControlReg.Go.Set();
}
//---------------------------------------------------------------------------
// DigitalReceiverDeviceMap::OnAfterStreamStartHandler()
//---------------------------------------------------------------------------
void DigitalReceiverDeviceMap::OnAfterStreamStartHandler(OpenWire::NotifyEvent & Event)
{
// Forward notify to baseboard handler
Owner->OnAfterStreamStart.Execute(Event);
}
|
As you can see, script processing occurs after the default Malibu library configuration of the onboard peripherals. In other words, both BSS and ASS scripts are able to supercede the standard initialization via your scripts. This has been used extensively internally and is known to work properly.
A more likely explanation for your inability to change the PLL frequency is that you are not addressing the registers within the Ics8402 PLL properly. This device has a large number of registers which must be programmed in order and properly in order to effect a frequency change.
Why are you attempting to bypass the standard Clock subobject of the DigitalReceiver board in the first place? The frequency programming features of the standard libraries should allow you to program the output frequency without resorting to use of scripts at all? _________________ Jim |
|
| Back to top |
|
 |
Sabeen Zameer
Joined: 12 Feb 2008 Posts: 10
|
Posted: Tue Aug 05, 2008 7:42 pm Post subject: |
|
|
Hi,
Thanx for your immediate reply, i tried changing sampling frequency through script because inspite of changing the output frequency on the GUI setup tab, it did not change the frequency to the desired value, it remains stuck with 43.2 MHz.
kindly mention what possible reason there could be.
Sabeen |
|
| Back to top |
|
 |
jhenderson Site Admin
Joined: 07 Mar 2006 Posts: 1178 Location: So. Cal. USA
|
Posted: Wed Aug 06, 2008 5:41 am Post subject: Unable to change sampling frequency |
|
|
Please post the Settings.ini file which is created within the example folder so that I can examine the configuration you are attempting to program. _________________ Jim |
|
| Back to top |
|
 |
Sabeen Zameer
Joined: 12 Feb 2008 Posts: 10
|
Posted: Wed Aug 06, 2008 7:50 pm Post subject: |
|
|
Hi
Here is the Setting.ini file. |
|
| Back to top |
|
 |
Sabeen Zameer
Joined: 12 Feb 2008 Posts: 10
|
Posted: Wed Aug 06, 2008 8:59 pm Post subject: |
|
|
"Settings.ini"
ActiveChannels=0100000000000000
AdcClockSource=2
AdcTest=00000000
AssScript
AutoStop=1
AutoTrigger=1
BssScript=F:\Visual Studio 2005\SnapCrap\clk_syn.txt
BusmasterSize=3
DdcScript
Divider=0
DividerClockSource=0
ExoFile
ExternalTrigger=0
FpgaClockSource=0
FrameCount=16384
Framed=0
LoggerEnable=1
OverwriteBdd=1
PacketSize=65536
PllClockSource=1
PllFrequency=100.8
PlotEnable=1
ReferenceFrequency=100
SamplesToLog=100000
ScriptEnable=010000
Target=0 |
|
| Back to top |
|
 |
Sabeen Zameer
Joined: 12 Feb 2008 Posts: 10
|
Posted: Wed Aug 06, 2008 10:40 pm Post subject: Latest findings while debugging the snap application |
|
|
In ApplicationIO:StartStreaming() PLL frequency is being set which is 100.8 MHz
Module.Clock().Frequency(Settings.PllFrequency*1.e6);
this function calls Ics8402::DoSetFrequency(double freq)
void Ics8402::DoSetFrequency(double freq)
{
// Cache Frequency
FFrequency = freq;
freq *= ClockFactor();
freq /= 1.e6;
//
// Determine which frequency divisor to use...
if (freq < (VcoHigh/16)) // 1st band to VcoHigh/16 Mhz
CtlReg.N.Value(3);
**(1st if statement executes in any case because VcoHigh is too large (700000000) and freq is divided by 1.e6)
else if (freq < (VcoHigh/ 8 )) // 2nd band to VcoHigh/8 Mhz
CtlReg.N.Value(2);
else if (freq < (VcoHigh/4)) // 3rd band to VcoHigh/4 Mhz
CtlReg.N.Value(1);
else // 4th band to VcoHigh/2 Mhz
CtlReg.N.Value(0);
//
// Calculate M field
int M_val = static_cast<int>(freq * (2<<CtlReg.N.Value()) / (Reference()/1.e6));
**(2<< 3 gives 16 which makes M_val=111)
// 'M' field limits: The "M" parameter must be chosen to provide a 'native'
// frequency between VcoLow and VcoHigh Mhz. This can then be divided
// by the 'N' factor.
// M(min) = F(min)/F(xtal) M(max) = F(max)/F(xtal)
const int M_max = static_cast<int>(VcoHigh / Reference());
const int M_min = static_cast<int>(VcoLow / Reference());
// ...Only allow M values in our sync band...
**( therefore everytime M_val becomes 48 through the following statement)
M_val = std::min(M_max, M_val);
M_val = std::max(M_min, M_val);
CtlReg.M.Value(M_val);
CtlReg.Reset = 1;
Sleep(1);
CtlReg.Reset = 0;
Sleep(1);
}
i think this is the reason why sampling freq sticks to 43.2Mhz because CtlReg.N.Value() is always 3.
And also when i peek the register 0x10 (clock and freq reg) after Stream.Start(); it gives the value that i set in the script. but on executing GetFrequencyActual() it returns 43.2MHz this has driven me crazy.
Please mention if this is a bug in this application, or i am getting it wrong?
Sabeen |
|
| Back to top |
|
 |
jhenderson Site Admin
Joined: 07 Mar 2006 Posts: 1178 Location: So. Cal. USA
|
Posted: Sat Aug 09, 2008 7:59 am Post subject: DR Clock Issues |
|
|
Yesterday, a technician installed the candidate release files for the DR module and confirmed proper operation of the software on a stock module. So, I am at a loss to understand why you are unable to change the sample clock frequency if you are using the internal clock, stock firmware and example software.
I recommend that you download the candidate release files by following the instructions at http://www.iidsp.com/forum/viewtopic.php?t=433&highlight=. Select the DR-Malibu product _________________ Jim |
|
| Back to top |
|
 |
|