Sunday, May 11, 2014

DAC done !!' For the new board !!

There are three scripts - m files - 

1. 

Just run the programNewDAC

2. 

Setup is seen as follows.

The dacs are on the other side ! 


Checking their voltage needs some finnese ! 

Adrf has I be programmed first !!

Adrf if left un programmed - has like 0.5 A of power consumption!! 

Friday, May 9, 2014

Stable triggering- Important stuff about triggering


Make sure that little arrow is above what u need !! Else u can't trigger it so well!! 

Use this nob :


Now when you try and trigger multiple channels together remember these things - 

1. Only one channel can be selected for the dso TDS 2024B as the source of trigger . What should you pick? Pick that trigger which gives Max date vs time. For example - 

I have set yellow channel as my trigger. Observe that the white arrow on top if the screen actually tells you where the capture is going to start from. 

Once all this is set. The other channels follow this trigger ! 

Yay! That's all the configurations needed for this setup ! 

today's testing on main boards

Visual studio setup must ! Set up solution file to x64!!



A B C rf pin configs




The TE connector schematics have changed.

DAQ side:


RF side:


Visual studio additional setup


Don't forget "setupapi.lib"

Saving property pages in visual studio.

http://manski.net/2012/01/sharing-project-properties-in-visual-c/

Everyone who has ever created and managed a C++ project in Visual Studio knows that there are hundreds of compiler switches and options to choose from. While setting the desired values for one project may be ok, it’s quite time-consuming and error-prone to do this for multiple projects. I’m currently working with a solution containing about 30 or so projects that share most of their project settings. I always wished there was a way to sync or share these common settings among the projects in the solution. Fortunately, there is: property sheets. They’re a bit hidden though, so I’ll explain how to use them in this article.

Thursday, May 8, 2014

Rf chip testing !

0. The setup 





Test bench:



1. Clock tested 


2. Data in pin tested - working 


4.done!! 

5. This has to wrap around twice ! 

There you go..

Just call it twice 














It worked !! It WORKED !!


Download these first !! 



Yay!! 




Onto the rf chip programming

SOLVED!!! Mystery of PINs 0-20 configurations.

Just add this to the GPIOinit() function :

apiRetStatus = CyU3PDeviceGpioOverride(18, CyTrue);
apiRetStatus = CyU3PGpioSetSimpleConfig(18, &gpioConfig);

Make sure you DONOT add anything in the main matrix mapping for the GPIOs else the USB fails to re-enumerate!

 io_cfg.gpioSimpleEn[0]  = 0x00000000; << KEEP THIS ZERO io_cfg.gpioSimpleEn[1]  = DAC_PORTS | 0x00002000 ;
 io_cfg.gpioComplexEn[0] = 0;
 io_cfg.gpioComplexEn[1] = 0; 

Setting up visual studio to run mex with CyAPI.lib working for your mexcodes.


Configuration properties -> General:
    Set Target Extension to .mexw64
    Set Configuration Type to Dynamic Library (.dll)

Configureation poperties -> VC++ Directories:
    Add $(MATLAB_ROOT)\extern\include; to Include Directories

Configuration properties -> Linker -> General:
    Add $(MATLAB_ROOT)\extern\lib\win64\microsoft; to Additional Library Directories

Configuration properties -> Linker -> Input:
    Add libmx.lib;libmex.lib;libmat.lib; to Additional Dependencies

Configuration properties -> Linker -> Command Line:
    Add /export:mexFunction to Additional Options

Wednesday, May 7, 2014

Make sure all softwares are x64 bit.

CyAPI has a 64 bit support!

Make sure you create a mex64 rather than a mex32. Previously they have caused problems.

You can find the x64 version on software.usc.edu

Understanding how to edit the Matlab Gui call backs.

Referring to:

http://www.mathworks.com/help/matlab/creating_guis/write-callbacks-using-the-programmatic-workflow.html

Summarizing:

1.Function handles provide a way for you to represent a function as a variable in MATLAB.
..

Actually you dont have to understand a lot. Its kinda high level job. Just make it work.  

Monday, May 5, 2014

Setting up MEX code building in Visual Studio 2010

1. Go to dreamsparks and download visual studio 2010. This is important as it gives proper support for the creation of MEX support provided by this guy:

http://www.mathworks.se/matlabcentral/fileexchange/39549-visual-studio-toolbar-for-mex-interface-with-video-tutorial

He says :
Automatically sets up debugging and running of MEX files from Visual Studio.
There is now a visual studio extension (simple click plugin type of install):
http://islab.hh.se/mediawiki/images/b/b0/VSMEX1.0.zipThe old type of Macros (that are not supported in newer versions of Visual Studio) are kept in the same zip file.
Video tutorial on my page:
http://islab.hh.se/mediawiki/index.php/Stefan_Karlsson/PersonalPage/mex_VS_tutorialOn youtube:
http://www.youtube.com/watch?v=JKDlPQZQqHk
2. Sln files are visual studio project files.
3. make sure the mex.h doesnt have a "squiggly" red line under it! Goto tools / options and matlab tab to setup the path for matlab.exe. 

Sunday, May 4, 2014

It's all me in the logs !! Yay!!





The DAC works !!

things in the code you should make sure they work: 





The setup 


Connected to a multimeter 


Multimeter will give exact measurements! 

The format - 

The first test case - 

what is the resolution ? 

2.5 / 2^12 for one bit . and calculate the others from this ! it's around 0.001 volts ! 

check the precision! 

the values are as follows 










Truncation of Unsigned char byte!

Note that 

#include <stdio.h>
#include <string.h>
main()
{
   unsigned char index=0xABC;
   printf("%x",index);
}

Compiling the source code....
$gcc main.c -o demo -lm -pthread -lgmp -lreadline 2>&1
main.c: In function ‘main’:
main.c:6:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    unsigned char index=0xABC;
    ^

Executing the program....
$demo
bc 

C code help / idea to debug whats happening !

Use online editor to test small codes and print the results before writing them onto the buffers on chip.

Simple print statements can end up letting you you know what is happening when.

One such online compiler is:

http://www.compileonline.com/compile_c_online.php

Some good online tutorials is as follows:

http://www.tutorialspoint.com/cprogramming/cprogramming_pdf_version.htm


Saturday, May 3, 2014

RF chip protocol



1.   RF Chip Control
The RF chip is controlled by the following 4 pins:
CHIP_REG_CLR: When 0, clear all register output to be 0.
CHIP_REG_CLK: clock.
CHIP_REG_DIN: Serial data input.
CHIP_REG_DOUT: Serial data output.
CHIP_REG_LOAD: Activate the data from the register buffer.

Connections mapping:
CHIP_REG_CLR               GPIO18
CHIP_REG_CLK                GPIO21
CHIP_REG_DIN                GPIO19
CHIP_REG_DOUT            GPIO17
CHIP_REG_LOAD             GPIO20

There are two modes for data transfer: (1) Write and Read; (2) Write only. The first mode is used to test the functionality of the register chain of the RF chip. The second mode is used for chip programming when the functionality if verified.
There are 86 register bits in total. Please see “SDSP RX Chip Control Bits Description”.

Mode (1): Write and Read. The input is sent twice consecutively. Read DOUT and compare the sent bits.
Mode (2): Write only.

Friday, May 2, 2014

The new boards here

Step 1.

Use cc limit settings !! 

2. start with zero voltages ! 


Always the positive first. 

Then inc the negative 

3. Connect USB 


Current is 

Check all the red points - 


They should match ! 

10 per values. 

These become very hot