Wicked Minds Electronics

AVR8 Schematic

11 posts in this topic

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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);
}

index.php?action=dlattach;topic=442.0;attach=235;image

Jack.

Schematic_Counter_w_internal_ports.zip

post-3-13431627531886.png

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