Robot Control Library


Jack Gassett

Recommended Posts

Hey everyone,

 

I was looking through OpenCores for some interesting libraries to port to DesignLab and I came across this Robot Control Library:

http://opencores.org/project,robot_control_library

 

It has:

  • PWM Encoder
  • Quadrature Decoder
  • Stepper Control
  • PID
  • Playstation 2 Joypad
  • Documentation
  • C Drivers

It seems like a very useful library to bring into DesignLab. I know there is overlap with other projects but this has some interesting features such as:

 

  • 8 Quad encoders with Pulse Count, Revolution count, Speed, and acceleration output.
  • 16 PWM with 2 Phase chopping, 1 Phase chopping, and enable chopping
  • 8 PID instances with Programmable sample time.

The project is targeted for the Xilinx ODB bus but after looking at the code it looks like the core IP is easy to connect to the wishbone bus instead. I spoke with the author in email and he has given us permission to use the core IP code, which he wrote, in any way that we want. He said to apply any license that we prefer to it. Originally I was thinking GPL, but maybe FreeBSD like the ZPUino license is better...

 

Any thoughts?

Jack.

Link to comment
Share on other sites

Jack,

You know I saw that one out there also. I had not had a chance to look it over it in depth though.  I think those types of functions would definitely be useful as they are common functions for those interfacing with hardware for maker types.

 

I am not sure if they are built all tied together or separate modules. I would think separate modules would be best to only use what a person needs.

 

I do have it in my plan to look over that one and a couple others I bookmarked with similar functionality. But I don't think it can hurt to have that as a designlab library myself.

 

Just my thoughts.

 

Thanks,
Chris

Link to comment
Share on other sites

 

It seems like a very useful library to bring into DesignLab. I know there is overlap with other projects but this has some interesting features such as:..

 

Originally I was thinking GPL, but maybe FreeBSD like the ZPUino license is better...

 

Any thoughts?

Jack.

Jack,

+1 from me. I think more Libraries is better even if they have overlapping parts. As fo the license maybe be like the ZPUno, but I guess it really depends how free you want to make it.  

 

.

 

I am not sure if they are built all tied together or separate modules. I would think separate modules would be best to only use what a person needs.

 

 

Thanks,

Chris

Chris, I think they are both :ph34r:  but at the end you take only what you select.... (this are thoughts from 5 min. code looking )

 

Filip

Link to comment
Share on other sites

I just got a single instance of the Quad Decoder working:

https://github.com/GadgetFactory/DesignLab_Examples/tree/Robot-Control-Library/libraries/Robot_Control_Library

 

I'm thinking that the schematic symbols will be separate modules, for example: Quad_Decoder, Quad_Decoder_x4, Quad_Decoder_x16, PWM, PWM_x4, PWM_x16 ... etc.

The c code will all be in a single Robot_Control_Library file. 

 

Jack.

Link to comment
Share on other sites

I ran into a roadblock with this library when trying to add multiple instances. We have Wishbone_to_Registers_x10 but that is not enough registers for multiple instances. I made a Wishbone_to_Registers_n.vhd file that lets us specify exactly how many registers are needed in a generic when you instantiate the component. You just set register_count to how many registers you need and there you have it...

 

This only works in VHDL because the input and output ports for the registers is an array of 32-bit vectors and the schematic editor does not have support for that structure. It does make it much more convenient to make larger Wishbone_to_Register_x30 symbols for the schematic editor though.

 

Jack.

Link to comment
Share on other sites

Hello,

the PID is a wishbone library now, but I'm not sure how to implement a easy changeable  'Sample clk' signal (its used as a timer - when to execute the PID)  without adding a separate module, to the PID lib., who will generate the 'Sample clk' rate ... 

 

Actually I think I just have to use the code from the source : (pid_sample is later the Sample clk signal)

          if slv_reg_write_select = To_StdLogicVector(reg_select) then            -- freq write            freq_register <= Bus2IP_Data(C_DWIDTH-C_FREQ_DIV to C_DWIDTH-1);            pid_sample <= not pid_sample;           end if;          if clk_count(C_FREQ_DIV-1 downto 0)=freq_register then            clk_count := (others => '0');            -- Update clk            -- pid_sample <= not pid_sample;          end if;

But may there is a better way...

 

 

Filip

Edited by Filip
Link to comment
Share on other sites

Well, we have the programmable pll module that Alvie made for the VGA module. But the pll only works for Spartan 6 devices, we need to make one using a DCM so it works with all devices. I'd just expose the clock to the top level of the symbol for now until we work out a good solution.

 

https://github.com/alvieboy/ZPUino-HDL/blob/work-0200/zpu/hdl/zpuino/wbpll.vhd

http://hamsterworks.co.nz/mediawiki/index.php/FreqSwitch

 

Jack.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.