element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Embedded Forum programming AD75019 with FPGA
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 37 replies
  • Subscribers 480 subscribers
  • Views 4113 views
  • Users 0 members are here
Related

programming AD75019 with FPGA

Former Member
Former Member over 13 years ago
Report Post       Today, 06:56 AM

Hello,
please , i want to program AD75019 , an analogue Cross point Switch from analogue devices 16x16, with FPGA, ad75019 have a serial interface, i'have to shift 256 bit into 256 bit shift register , once the register is full i apply a PCLK pulse to to transfer the register to latch (like it's mentionned in the datasheet) my problem is, that i can'T close or open any switch image
please , anyone could help, thanks in Advance

 

this my configuration:

 

VDD:11V
VCC:5V
VSS: 0V

 

SCLK: 1MHZ

 

this how i did the spi interface : a shift register of 256 bit with a state machine for controlling PCLK signal:

 


-- spi_SM.vhd

 


library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_signed.all;
use ieee.std_logic_arith.all;

 

entity spi_SM is

 

generic(N:integer :=256; C:integer :=9; D:integer :=4 );
-- generic(C:integer :=9);
port(
clk :in std_logic;
rst_n:in std_logic;

 

data: in std_logic_vector (N-1 downto 0);
SCLK: inout std_logic; --inout pour qu'il peut etre lu en process
SIN imageut std_logic;
PCLK: out std_logic

 

);
end spi_SM;

 

architecture rtl of spi_SM is

 


type States is (ACTIF, UPDATE, IDLE);
signal state : States := ACTIF;
signal EndSend : std_logic_vector(8 downto 0);
signal t_rst_cnt_n : std_logic ;

 

--Diviseur (pour generer la frequence d'horloge du port SPI(20Khz-5Mhz))
component diviseur
generic ( N : integer := 4 );
port(
clk : in std_logic ;
rst_n : in std_logic ;
clk_out : out std_logic
);
end component;

 

--Compteurnbit
component Compteurnbit
generic ( N : integer := 16 );
port(
clk : in std_logic ;
rst_cnt_n : in std_logic ;
OutCount : inout std_logic_vector(N-1 downto 0)
);
end component;

 


--Sregister
component Sregister
generic ( N : integer := 256 );
port(
clk : in std_logic;
rst_n : in std_logic;
S :in std_logic_vector (N-1 downto 0);-- durée de train d'impulsion
Q : out std_logic
);
end component;

 


begin

 

U0_diviseur : diviseur generic map(D) port map(clk, rst_n, SCLK); ---definir frequence de SPI (clk de base=20 Mhz)
U0_Sregister : Sregister generic map(N) port map(SCLK,rst_n,data,SIN);
U0_Compteurnbit : Compteurnbit generic map(C) port map(SCLK,t_rst_cnt_n,EndSend);-- counting 256 pulse to set EndSend

 


send : process (SCLK,EndSend)
begin

 

if (rst_n='0') then
t_rst_cnt_n<='0';
else
case state is
when
actif=>
if (unsigned(EndSend) = 256) then -- opertation arithmetique donc convertit std_logic_vector en unsigned
PCLK<='0';--0
t_rst_cnt_n<='0';
state<= UPDATE;
else
t_rst_cnt_n<='1';
PCLK<='1';
state<= ACTIF;
end if;
when UPDATE=>
PCLK<='1';--0
-- state<= actif ;
state<= IDLE;
when IDLE=>
PCLK<='1';
state<= IDLE;

 


end case;

 

end if;
end process;

 

end;


  • Sign in to reply
  • Cancel
Parents
  • michaelkellett
    michaelkellett over 13 years ago

    Hello Hachani,

     

    I can't critique your SPI code because the style you use is so different from mine and the formatting has been lost. I can see lot's of things that are not the way I would do them but I'm not at all sure that they would be the problem.

     

    I do this kind of work all the time and recomend the following steps to debug it:

     

    design

    simulate the VHDL - if the simulation doesn't work the hardware never will ! It is ALWAYS worth writing a test bench.

    test the hardware - you will NEED a logic analyser - it is almost impossible (and takes at least 10x as long) to debug without. A cheap one is fine. A scope is very useful but not quite esential.

     

    Let me know what your simulation output looks like and what hardware you have for testing and I'll see if I can be  a bit more helpful.

     

    Michael Kellett

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • michaelkellett
    michaelkellett over 13 years ago

    Hello Hachani,

     

    I can't critique your SPI code because the style you use is so different from mine and the formatting has been lost. I can see lot's of things that are not the way I would do them but I'm not at all sure that they would be the problem.

     

    I do this kind of work all the time and recomend the following steps to debug it:

     

    design

    simulate the VHDL - if the simulation doesn't work the hardware never will ! It is ALWAYS worth writing a test bench.

    test the hardware - you will NEED a logic analyser - it is almost impossible (and takes at least 10x as long) to debug without. A cheap one is fine. A scope is very useful but not quite esential.

     

    Let me know what your simulation output looks like and what hardware you have for testing and I'll see if I can be  a bit more helpful.

     

    Michael Kellett

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • Former Member
    Former Member over 13 years ago in reply to michaelkellett

    thanks Michael  for your answer ;

     

    for the spi code , actually it's my second time that i wrote an spi code (i mean i'm a beginner ) the first time was to control a chip of 8 DAC, LTC1665CGN#PBF.LTC1665CGN#PBF., i have to send about 80 bit , so i did a FSM with 80 state in each state i send 1 bit , here it's about 256 bit , so i thought it's more easy to use a shift register of 256 bit instead FSM of 256 state  , and in each clock cycle i shift with one bit , it's as same as sending one bit .the simulatyion result looks fine i join a screenshot for it.

    well for hardware testing , i wont to apply rectangular wave form  node y15, and y14, and i wont to receive just in node x1 and x0

     

          imageimage

     

    thanks for your help image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett over 13 years ago in reply to Former Member

    @ Hachani,

     

    Can you post zoomed in samples of your simulation output - I can't see the precise relationship between clock and data in transitions and PCLK pulse.

     

    When you drive hardware is you clock frequency in range and are you sure that the power supplies sequence correctly as described in the data sheet ?

     

    Michael Kellett

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 13 years ago in reply to michaelkellett

    Hi Michael,

     

    the clock master of the SPI here is SCLK= 1.2 MHZ i got it from dividing the the clock system (clk=20MHZ) , i mean that PCLK depend directly from SCLK

     

    for the power supplies , yes i do respect what is mentioned in the datasheet

    VDD:11V

    VCC:5V

    VSS: 0V                                 min        max                         what i did

    VDD to DGND               –0.5       +25.2 V              11v

    VSS to DGND               –25.2       +0.5 V                0v

    VCC to DGND              –0.5          +7.0 V                5v

    VDD to VSS                 –0.5       +25.2 V                11v

    VCC to VSS                  –0.5          +25.2 V             5v

    Digital Inputs to DGND    –0.3 VCC + 0.5 V             3.3v (output of FPGA igloo)

     

    I doubt about the way that i code the spi code , can you tell me please how do you make tour own spi code ? i'm using Libero for IGLOO FPGA, when i searched for ip core of spi, i found it but, it should be interfaced with a microcontroller like 8051 :/

     

    thanks for your help image

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett over 13 years ago in reply to Former Member

    @ Hachani,

     

    Now we are getting somewhere:

    I was sure you would have the correct power supplies but the sequencing is important too.

     

    But I think there is a big problem which your latest simulation shows up:

     

    From the timing diagram on page 3 of the data sheet the AD75109 needs a definate data set up time (>20nS) between a change on SIN and the rising edge of SCLK and even longer (65nS) for PCLK. The maximum lnegth of the PCLK pulse is quite short too.

     

    From your simulation results you are changing SIN and PCLK at exactly the same time as the rising edge of SCLK - this can't be expected to work.

     

    I haven't got time to dig out some SPI code and post it here today but I'll try to do it later.

     

    Do you really want to use a 256 bit wide input to the SPI thing - it seems very inefficient to me - what generates the bit pattern for the AD75109 or is it fixed ?

     

    Michael Kellett

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 13 years ago in reply to michaelkellett

    hello Michael ,

     

    i hope that the data set up time t1>20nS , would be the solution of my problem image, well in this case i have a question , how can i make this delay t1, and i'm sure that sclk is synchronies with the corresponding data as in timing diagram ?

     

     

    Do you really want to use a 256 bit wide input to the SPI thing - it seems very inefficient to me - what generates the bit pattern for the AD75109 or is it fixed ?

     

     

    i did not understand clearly your question image , tell me  if this is an answer for question or no please:

    i'm using a register of 256 bit, and  i instantiate the in the main program , so i have a signal  that contained the pattern

    --Switch Matrix

    signal data: std_logic_vector(255 downto 0):=  X"0001000000000000000000000000000000000000000000000000000000000000";

     

    do you think thers is another way to apply the pattern ?

     

    thanks

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett over 13 years ago in reply to Former Member

    Hello Hachani,

     

    As far as timing goes I think you need a bit of a re-think.

     

    If you make your main process loop synchronous and clocked by the 20 MHz clock it gets very easy to add delays between output edges in 50nS steps.

     

    I can't spare the time right now but I'll try to put something together in the next few days to show you how.

     

    Re 256 bit pattern:

     

    You have a pattern that contains 1 bit set out of 256 and to transfer it you are going to need at least 256 logic cells but unless you are careful with your design it might use 512 or even 756.

     

    If your application only ever sets two or three bits in the pattern you could define them with two or three bit position inputs of only 8 bits each.

     

    If your FPGA has memory blocks of some kind that you can set up so they are intiialsied at start up you could make an array of 32 x 8 bit numbers and now your AD75109 interface will suddenly become a lot smaller.

     

    Which FPGA are you using ?

     

    Michael Kellett

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 13 years ago in reply to michaelkellett

    Hi ,

     

    RE 256 pattern:

    in my application there is maximum of 16 bit that they will  be set with an arbitrary way , however i have always to update the dynamic register of AD75019, i mean, in my design whatever the number of changing bit i have to send 256 bit each time i change bit setting,

    i didn't use memory before, but i think even in this case i have to send also 256 bit each time i change the pattern

    the FPGA that i use is:  AGL060V5 VQ100

     

    thanks Michael,

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett over 13 years ago in reply to Former Member

    Hello Hachani,

     

    Yes you will always have to send a 256 bit pattern to the AD chip but you can specify your bits by defining 16 bit positions each of which needs only 8 bits for 128 bits in total.

     

    But the better way is to use some memory if it's not being used.

     

    I've never used the Actel tools but I'm sure there will be a way of defining  block of memory that is pre-set on start up.

     

    Then you can read out of it and send that data to the spi interface - or possibly read it directly in the spi interface.

     

    The most efficient use of logic resources will be to define the memory as a 1 bit wide block and read out a single bit for each bit you send to the AD chip.

     

    I'll look at the Actel tools and see if I can work out how to do it.

     

    Michael Kellett

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 13 years ago in reply to michaelkellett

    Hi Michael,

     

    i didn't add a delay yet for my design (t1>20nS) however after thinking, i didn't think that this delay is the cause of my  problem (i can't close or open any switch individually they are all closed) beacause even i send a sequence all 1 or all zero , all switch still closed . here t1 is transparent since all bit are in the same level , and at least for a combinaison of all 0 i have to get all switch opened but they still all closed image  , ( just a note for the DGND:  i connect DGND to the analog ground with a capacitor of 0.1 uF )

     

    what do you think ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett over 13 years ago in reply to Former Member

    Hello Hachani,

     

    You (usually) have to do everything the data sheet says to make it work. You don't have a delay for PCLK either and that may well be important.

     

    The digital and analogue grounds should be directly connected. With your supplies the analogue signals must not go below 0V.

     

    Have you looked at the real signal swith a scope yet.

     

    Michael Kellett

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube