Papilio host comms support library.

Recommended Posts

Does anybody have a working host comms library and IP for the Papilio?


I know we can just use serial but I want something that will be a lot more friendly and abstracted ... so I can write something like this to test servos...





  // set position of servos on reg 0 and reg 1




  // set postion of servos on reg 0 and reg 1









An the FPGA end it should ideally look as if it is connected to a RAM.
  address - from host
  datain - from host

  dataout - to host

  read_strobe - from host
  write_strobe - from host
  ack - to host





Share this post

Link to post
Share on other sites

Opps! yes, from a host PC to/from FPGA. All I really am after is an abstracted way to update registers in a design - for 'command + control' over a design.

Share this post

Link to post
Share on other sites

Doesn't sound like anyone has anything but you could use something common like I2C since there are both FPGA implementations of I2C controllers and open source C implementations and libraries on the PC side.

Share this post

Link to post
Share on other sites

Hamster, perhaps you might want to take a look at my SerProv3 library (it's now being shipped with ZAP, should support any CPU system).


SerProV3 is a library in C++ for both host and target that supports RPC in a very transparent way. It uses C++ features to allow for automatic (to some extent) serialization and deserialization of data.


It does require C++ on both ends, though. It is shown to work with native linux, GLIB, and Qt. Other host "backends" are possible.


All communications are done through a transparent serial link, like RS232, but can be adapted to other transport mechanisms.


This simple example for Arduino/ZPUino uses SerProV3 to export three functions, the user "myFunction" and the native "digitalWrite()" and "digitalRead()":

#include <SerPro3.h>uint32_t myFunction(uint32_t a, uint32_t {   return a + b;}SERPRO_ARDUINO_BEGIN();EXPORT_FUNCTION(1, myFunction);EXPORT_FUNCTION(2, digitalWrite);EXPORT_FUNCTION(3, digitalRead);SERPRO_ARDUINO_END();void setup(){  Serial.begin(115200);}void loop(){  if (Serial.available()>0) {    SerPro::processData(Serial.read());  }}

On the host side, we just need to "import" those functions, and tell the system what are their arguments:

#include <SerPro/SerPro-glib.h>#define OUTPUT 1SERPRO_GLIB_BEGIN();IMPORT_FUNCTION(1, myFunction, uint32_t (uint32_t,uint32_t) );IMPORT_FUNCTION(2, digitalWrite, void (uint8_t,uint8_t) );IMPORT_FUNCTION(3, digitalRead, int16_t (uint8_t) );SERPRO_GLIB_END();void connect() // This is called when protocol connects{  digitalWrite( 3, 1 );  printf("8 plus 8 is %u\n", myFunction(8,8));}int main(int argc, char **argv){  if (argc<2)    return -1;  if (SerProGLIB::init(argv[1],B115200)<0)    return -1;  SerProGLIB::onConnect( &connect );  SerProGLIB::start();  SerProGLIB::run();}

Perhaps is something like this you are looking for ?




Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now