hamster Posted July 2, 2013 Report Share Posted July 2, 2013 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... if(!PapilioOpen(NULL)) return; // set position of servos on reg 0 and reg 1 PapilioRegWrite(0,255); PapilioRegRead(1,255); sleep(1); // set postion of servos on reg 0 and reg 1 PapilioRegWrite(0,0); PapilioRegRead(1,0); sleep(1); PapilioRegWrite(0,255); PapilioRegRead(1,255); PapilioClose();} 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 Thanks! Mike Link to comment Share on other sites More sharing options...
alvieboy Posted July 3, 2013 Report Share Posted July 3, 2013 Hey Mike, you're talking about standalone code (FPGA only), or PC <-> FPGA ? Link to comment Share on other sites More sharing options...
alvieboy Posted July 8, 2013 Report Share Posted July 8, 2013 Ping Hamster Link to comment Share on other sites More sharing options...
hamster Posted July 8, 2013 Author Report Share Posted July 8, 2013 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. Link to comment Share on other sites More sharing options...
alex Posted July 8, 2013 Report Share Posted July 8, 2013 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. Link to comment Share on other sites More sharing options...
OmniTechnoMancer Posted July 9, 2013 Report Share Posted July 9, 2013 I have seen a project called UART to Bus on opencores that implements a uart controlled memory interface like this. http://opencores.org/project,uart2bus This may help with your problem hamster? It supports both an ascii mode and a binary mode. Link to comment Share on other sites More sharing options...
alvieboy Posted July 9, 2013 Report Share Posted July 9, 2013 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 ? Best,Alvie Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.