LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI Register Level Access Using VISA

Hi All,
 
Situation:-  I have to write some code that interfaces with a custom PCI card purely at Register access level, no DMA etc.  This card has an FPGA and some flash memory, and i just need to access the FPGA registers.  The Register Map Supplied by the customer starts at 0x0.
 
Progress so far:- I have trawled the forum and created an .inf file from the VISA Driver Development wizard.  I have installed the file and got a handle to my PC Device under MAX.  I can initialise, map some address space and read the Configuration registers using the attached code.
 
Problem:-  The FPGA registers start at 0x0 so does the PCI configuration register.  I Know there must be an offset and i think that this is held in BAR0/1 (Base Address Register 0 or 1).  How do i map to BAR 0 though?
 
Questions:- Do i Read BAR0 Then Unmap the Previously mapped PCI configuration address space or do i directly access the FPGA by Using PCI Config base register (0x0) + Value Read from BAR0/1.
 
Any Pointers Most Welcome (Pun Intended)
Thanks In Advance
Craig
LabVIEW 2012
0 Kudos
Message 1 of 7
(5,487 Views)
Bump...
LabVIEW 2012
0 Kudos
Message 2 of 7
(5,460 Views)
Hi Craig

I don't have any personal experience of register level programming so I am afraid I can't help with the exact problem you have. Are you aware of the VISA Test Panel? You said you have manage to get a handle to your device in MAX...if you select your device and then click on 'Open VISA Test Panel' at the top it will be launched. This have a play around with this utility as it may help you get access to the registers you require. The 'Register I/O' tab in particular may well be useful.

Can I also suggest re-posting on the Driver Developement Kit board as it may be a bit more relevent to your issue.

I hope this helps
0 Kudos
Message 3 of 7
(5,248 Views)

Hi Rich,

I am familiar with VIC.  I have managed to get a Handle to the device in MAX and am able to read some of the configuration registers in both LabVIEW with VISA low level peek and poke and in VIC.  Im afraid my problem lies more in my limited knowledge of the PCI Register mappings.  From What i have read, i think i need to know wehre my FPGA Base address resides.  This Base address is in either the BAR0 or BAR1 registers within the PCI Configuration registers (Which i have access to).  From playing around i think i have found that i have to do something along the lines of the following.

 

-Map the PCI Configuration register

-Read BAR0 and BAR1, find out which one is the FPGA.

-Unmap the PCI Register.

-Map appropriate BAR0 or BAR1 address's

 

I Think this will enable me to have access to the FPGA registers starting at Base address 0x0 from there on in.

Thanks for having a look though,  I will also point towards this thread from the DDK forum and hopefully get some more information on this.

Thanks again

Craig

LabVIEW 2012
0 Kudos
Message 4 of 7
(5,191 Views)

Craig,

 

Did you ever get this figured out?  I'm trying to do the same thing now.

 

 

Thanks,

Josh

0 Kudos
Message 5 of 7
(3,450 Views)

Hi,

 

I didnt notice this post as I have not frequented the forums for a while and only noticed by looking through my old posts (This ones approx 3 years old!).  Yes I did get it working.  I cant exactly remeber but I think BAR0 registers are things to do with the PCI Bus itself and BAR 1 is the start of the user defined register space.  I remeber it was actually quite easy as all I needed to do was to write down to BAR1 Base plus my Register offset.  I Know it is a really late reply and a bit vague however I done this job as a contractor over 3 Years ago and have no access to the code.  However if this reply helps you or any others out in anyway so be it 🙂

 

Craig

LabVIEW 2012
Message 6 of 7
(3,371 Views)

Craig,

 

Thanks for the reply.  I figured out my problem was related to the endian of everything.  Even though I was told that VISA uses big endian, and was told the PCI card I was using required big endian, I had to do a byte swap to get things to read and write properly.

 

I'm not entirely sure why this is.  My theory is it has to do with windows swapping everything internally somewhere along the way or possibly the PCI bus assuming it is little endian coming from windows and swapping it 

Message 7 of 7
(3,369 Views)