Wicked Minds Electronics Posted April 14, 2012 Report Share Posted April 14, 2012 I am new to FPGA but pretty experienced with AVR and digital logic in general. I am using WebPack ISE. I am still learning VHDL by use of schematics and seeing what it generates. What I am trying to do is create a project where my schematic is the "Top Module". How do I create a symbol for the AVR8 so that I use it in schematics? I have created symbols for other simple things and I did create a Papilio_AVR8 symbol but when added to a schematic in a new project throws a fit during synthesis with warnings and errors too cryptic for my current level of understanding. Basically the device I am interfacing Papilio to requires some I2C commands to be sent to initialize the device and enable it's outputs. I currently have an Arduino sketch that performs this function and also forwards I2C commands received via rxd/txd to the I2C bus using an UNO and want to just add the AVR core to my schematic so that I can init the external device and get data coming into the custom logic I have created. The perfect thing would be a symbol that obeys the options that determine which ports to include so that I can generate a symbol with only the AVR port pins needed for I2C. Thanks for any help you can provide. Great product by the way, I started learning FPGA about two weeks ago, got my Papilio from SparkFun and had a custom circuit running and providing expected output in a matter of a couple of hours. Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 14, 2012 Report Share Posted April 14, 2012 Hello, Thank you for joining us! I'm not very proficient with the schematic entry tool but I was able to put together an ISE project with a schematic as the top level for you. It synthesizes and runs correctly on the Papilio One. Its just the AVR8 at this point, I tried to do better and connect a counter to porta as an example. But since it was my first time ever using the schematic I ran into a couple things that I would need to spend more time learning about the schematic tool to get past. If I get a chance I will read through some tutorials and try it again, but I figured this might be enough to help you out. Jack. AVR8_Schematic.zip Link to comment Share on other sites More sharing options...
Wicked Minds Electronics Posted April 15, 2012 Author Report Share Posted April 15, 2012 Hello, Thank you for joining us! I'm not very proficient with the schematic entry tool but I was able to put together an ISE project with a schematic as the top level for you. It synthesizes and runs correctly on the Papilio One. Its just the AVR8 at this point, I tried to do better and connect a counter to porta as an example. But since it was my first time ever using the schematic I ran into a couple things that I would need to spend more time learning about the schematic tool to get past. If I get a chance I will read through some tutorials and try it again, but I figured this might be enough to help you out. Jack. Thanks so much for taking the time to set that up for me! I had to jump through alot of hoops to solve some Vista64bit specific issues I had with getting the Adruino IDE working. Once I got a blinky sketch working with the stock AVR8 soft core, I switched and used the custom bits from the project you provided and blinky worked fine. Now to try and get I2C working Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 15, 2012 Report Share Posted April 15, 2012 Good, So a Papilio user named Laurent sent me a zip file with an arduino sketch that he used to get I2C working on the Papilio for another project. I have not had a chance to publish it on the playground so I'm going to attach it here for you. BTW, I'm working on an example to connect a counter in the schematic right now. If I get it working I will post it soon. Jack. IMU_I2c_itg3200_SR.zip Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 15, 2012 Report Share Posted April 15, 2012 Ok, I have an example that connects a counter to porta working and attached. The important thing to note is that you have to go into the AVR8 source code and manually set DDRA to be inputs... Unfortunately this is necessary because the porta-f pins are tristated and HIGH-Z is only available on external pins. When you try to remove an external pin from the schematic and use an internal connection, like is done with the counter the tristate will no longer work. So you will need to manually set the DDR register to input or output, depending on your application. Here is an example sketch: void setup() { //Setup Serial port and send out Title Serial.begin(9600); } void loop(){ Serial.println("Counter"); Serial.print(PINA, DEC); delay(1000); } One more thing, the ZPUino is a really nice processor with lots more peripherals then the AVR8. Alvie even has an I2C hardware peripheral working on the ZPUino. Jack.Schematic_with_counter.zip Link to comment Share on other sites More sharing options...
Wicked Minds Electronics Posted April 15, 2012 Author Report Share Posted April 15, 2012 Good, So a Papilio user named Laurent sent me a zip file with an arduino sketch that he used to get I2C working on the Papilio for another project. I have not had a chance to publish it on the playground so I'm going to attach it here for you. BTW, I'm working on an example to connect a counter in the schematic right now. If I get it working I will post it soon. Jack. I was able to extract the I2C library from Laurents code and implement it in my sketch successfully. The only modification I had to make was to assign the correct pins to the SDA_LINE and SCL_LINE constants. My external I2C device runs on a 2.8v I/O and in the past I had to run a level converter between it and my 5v Arduino to communicate with it via I2C. Thanks to this solution I was able to pull the level converter and 5v Arduino from my breadboard and now the Papilio alone initializes the I2C device directly My original circuit to process the 8 bit parallel data coming from the I2C device involved about 15 chips and was still growing when I began looking at Papilio. So far I have been able to draw up the same schematic I was using for physical components using WebPack schematics and now that I don't need to run a physical AVR on the side, this is just too awesome. It is a wonderful feeling to add components to a schematic and not have to wonder "do I have any of these chips? does digikey stock them? how much is this going to increase the cost? how much is this going to increase the pcb footprint" etc etc Thanks again for the great support and examples! Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 16, 2012 Report Share Posted April 16, 2012 Well, I couldn't leave this one alone, the last schematic example was an ugly hack. I thought about it all day and realized the best way to do this is to add an in and out for each port that allows schematic elements to be connected without changing DDR values inside. I think it is a much nicer arrangement, here is an example sketch: void setup() { //pinMode(15, OUTPUT); //Uncomment this if you want to see the output on the physical pin. //Setup Serial port Serial.begin(9600); } void loop(){ digitalWrite(15, HIGH); Serial.print("Counter: "); Serial.println(PINA, DEC); delay(1000); digitalWrite(15, LOW); } Jack.Schematic_Counter_w_internal_ports.zip Link to comment Share on other sites More sharing options...
Wicked Minds Electronics Posted April 16, 2012 Author Report Share Posted April 16, 2012 I like that a lot better! Now... How hard would it be to change the AVR8 DRAM to dual port so that devices could write directly to a memory space? Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 17, 2012 Report Share Posted April 17, 2012 Well, there is already the framework and a tutorial video about how to add your own devices to the internal I/O space: http://papilio.cc/index.php?n=Papilio.CustomAVR8UserCore I guess the challenge would be how to turn it into a schematic instead of a VHDL file. Jack. Link to comment Share on other sites More sharing options...
fazel459 Posted April 14, 2016 Report Share Posted April 14, 2016 Hi I can not download the attached files please upload again thanks Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 18, 2016 Report Share Posted April 18, 2016 The downloads work for me, but its pretty old... This is probably the latest: https://github.com/GadgetFactory/Arduino-Soft-Core But please note, I've not done any AVR8 development in years now. ZPUino is the preferred solution now. Jack. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.