Guest boseji Posted April 14, 2012 Report Share Posted April 14, 2012 Hello, I wish to acess the GPIO for C bank on the Papilio One 250k. This is due to the need that I requirered 16-bit data bus read in parallel. I am using the ZPUino IDE 1.0 version. Kindly help me out with this. Warm Regards, Boseji Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 14, 2012 Report Share Posted April 14, 2012 Hello boseji, I think Alvaro's going to be driving a while tomorrow and won't be able to respond so let me take my best guess at this. If I understand correctly you want to do a port read instead of a single pin read. Like doing the following on an AVR: var = PINA So Alvaro is going to have the final answer but this is what I think. All peripherals are connected to I/O slots in the ZPUino and GPIO is one peripheral I believe so it will be connected to a slot which will give us the base address. We should be able to find the information we need in the arduino-0100-Z/hardware/zpuino/cores/zpuino directory. Looking at board_papilio_one.h gives us good information about the names for individual pins but is not exactly what we are looking for. If we look at register.h we are getting much closer. We can see that GPIOBASE is connected to IO_SLOT(2) and that GPIODATA seems to be the way to access GPIO data. #define GPIOBASE IO_SLOT(2) #define GPIODATA(x) REGISTER(GPIOBASE,x) So two things I'm not sure about are the size of integers for ZPUino and how do we read wing row C. For the first we can look at zpuino-types.h and see: typedef unsigned int uint32_t; I'm pretty sure that doing the following will read the first 32 I/O pins which would be Wing row A and B: unsigned int pins; pins = GPIODATA(0); And I think to get row C would be: unsigned int pins; pins = GPIODATA(1); The first 16 bits of pins would be row C, or you could do to just get row C: unsigned short pins; pins = GPIODATA(1); Anyway, I think that's how it should work but I'm not positive, so maybe give it a try and Alvaro can set us straight. Ultimately we really need to get all of this documented. I setup a wiki at zpuino.gadgetfactory.net and we will try to start getting documentation up there. If anyone has a desire to help out with ZPUino documentation it would be greatly appreciated. Jack. Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 14, 2012 Report Share Posted April 14, 2012 Ok, This is the beauty of having an open source soft processor. I wasn't sure how the registers for the GPIO were mapped so I just took a peek at the zpuino_gpio.vhd file and I see: case wb_adr_i(3 downto 2) is when "00" => wb_dat_o <= gpio_r_i(31 downto 0); when "01" => wb_dat_o <= gpio_r_i(63 downto 32); when "10" => wb_dat_o <= gpio_r_i(95 downto 64); when "11" => wb_dat_o <= gpio_r_i(127 downto 96); when others => end case; So this should mean that when you read the first GPIO address by doing a "pins = GPIODATA(0);" you will get the first 32 pins, and "pins = GPIODATA(1);" gets you the next 32. Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 14, 2012 Report Share Posted April 14, 2012 Well, another response. I was just going to bed and thinking, geez, he's probably going to need information on the timers next, and how can we best get this information easily available to people. Then I remembered something! Alvaro has already thought of this. He is working on a datasheet/reference for the ZPUino that is actually pretty far along already. I just looked at it and it has the exact information you are looking for on the GPIO with code examples to boot. And when you need information about the other peripherals that are available, like the VGA core, timers, deltasigma, or how the Peripheral Pin Select functionality works, it is all there! So check it out, the ZPUino reference doc: http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf Jack. Link to comment Share on other sites More sharing options...
Guest boseji Posted April 15, 2012 Report Share Posted April 15, 2012 Thanks a lot. Now input Scan code is working. I missed to see the manual. I am using the Lower 32bits for the I/O. This means that I am able to read AL+AH+BL+BH in one read cycle. That's extremely powerful 8) . And considering the core is 32bit I can perform manipulations right using these commands. Here is the code I am using to scan the pins: #include<inttypes.h> uint32_t p1; void setup() { Serial.begin(9600); GPIOTRIS(0)=0xFFFF; p1 = GPIODATA(0); } void loop() { Serial.print(p1,BIN); Serial.print("\n"); delay(1000); p1 = GPIODATA(0); } The next thing would be to implement a FT245 driver on this so that I am able to send 8-bits in parallel. As Serial is too slow for reading data at high speed. This is related to the project I am trying to do. One more important thing is that I am observing - the FPGA is warming up if I reduce the timing of my scan. Hope that this is normal. Also the regulators are getting up in temperature. Guess running at 96MHz has its price Warm Regards, Boseji Link to comment Share on other sites More sharing options...
alvieboy Posted April 15, 2012 Report Share Posted April 15, 2012 The next thing would be to implement a FT245 driver on this so that I am able to send 8-bits in parallel. As Serial is too slow for reading data at high speed. This is related to the project I am trying to do. If you really need more speed, I'd really advise to implement this in HDL. Should be fairly simple. One more important thing is that I am observing - the FPGA is warming up if I reduce the timing of my scan. Hope that this is normal. Also the regulators are getting up in temperature. Guess running at 96MHz has its price [img alt=]http://www.gadgetfactory.net/gadgetforum/Smileys/default/smiley.gif Yes, it should still warm a bit (even with 1.0 release, although not as hot as previous versions). Eventually I'll need to add power saving options at some time. 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.