Jack Gassett Posted February 18, 2013 Report Share Posted February 18, 2013 Ok, So I reworked the Papilio SOC library so we could build an entire SOC for the LogicStart MegaWing. I ran into a roadblock with getting GPIO to work with modified ucf files, it was really cumbersome and put a lot of burden on someone who is just starting out with FPGA's. I thought about it a couple days and came up with a way where you can just swap out a symbol for whatever type of hardware you have connected to the Papilio. Here is a video of the reworked system in action! I think this is all coming together nicely and the next steps are to come up with an appropriate name and start writing Arduino libraries and writing an ebook. I'm thinking I will start the ebook and work on one chapter at a time, each chapter will correspond to a peripheral core and I will work on the library for that core as I write the chapter. I can use some feedback for what to call this. Initially I thought it would be Papilio SOC but I worry that casual users, who are the target for this system, won't be familiar with the term System on Chip. So I'm thinking along the lines of:DrawDuinoDraw-a-duinoDrawADuino Any thoughts or better names? The code for the system as it stands is on github. Sketch:#include "LogicStart.h"#include <SmallFS.h>#include "VGAZX.h"#include "fixedpoint.h"#include "cbuffer.h"#include "ptplay.h"#define USPIDATA16 *((&USPIDATA)+2)#define SEVENSEGBASE IO_SLOT(9)#define SIGMADELTABASE IO_SLOT(5)static SmallFSFile modfile;static char buf[128];static pt_mod_s * mod;static CircularBuffer<unsigned,7> audioBuffer;extern pt_mod_s *pt_init_smallfs(SmallFSFile &file);static int timeout=0;int ledPins[] = { 40, 41, 42, 43, 44, 45, 45, 47 }; // an array of pin numbers to which LEDs are attachedint ledCount = 8; // the number of pins (i.e. the length of the array)int buttonPins[] = { 32, 33, 34, 35, 36, 37, 38, 39 }; // an array of pin numbers to which Buttons are attachedint buttonCount = 24; // the number of pins (i.e. the length of the array) int buttonState = 0; // variable for reading the pushbutton statusint thisPin;int ledState = LOW; void setup(){ // initialize the LED pins as an output: for (int thisPin = 0; thisPin < ledCount; thisPin++) { pinMode(ledPins[thisPin], OUTPUT); } // initialize the pushbutton pin as an input: for (int thisPin = 0; thisPin < ledCount; thisPin++) { pinMode(buttonPins[thisPin], INPUT); } VGAZX.begin(15); SmallFS.begin(); SmallFSFile f = SmallFS.open("scr1"); if (f.valid()) VGAZX.loadscr(f); Serial.begin(115200); modfile = SmallFS.open("music.mod"); mod = pt_init_smallfs(modfile); SIGMADELTACTL=0x3; TMR0CTL = 0; TMR0CNT = 0; TMR0CMP = ((CLK_FREQ/2) / FREQ )- 1; TMR0CTL = _BV(TCTLENA)|_BV(TCTLCCM)|_BV(TCTLDIR)| _BV(TCTLCP0) | _BV(TCTLIEN); INTRMASK = BIT(INTRLINE_TIMER0); // Enable Timer0 interrupt USPICTL=BIT(SPICPOL)|BIT(SPISRE)|BIT(SPIEN)|BIT(SPIBLOCK)|BIT(SPICP2)|BIT(SPICP0); INTRCTL=1;}static unsigned char table7seg[16] ={ 0x3F, //00111111, 0 0x06, //00000110, 1 0x5B, //01011011 2 0x4F, //01001111 3 0x66, //01100110 4 0x6D, //01101101 5 0x7D, //01111101 6 0x07, //00000111 7 0x7F, //01111111 8 0x6F, //01101111 9 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};static int int_to_7seg(int v){ return table7seg[v%16];}int cnt = 0;int ledcnt = 0;int extcnt = 0;int mode = 0;unsigned channel=0;static void set_sevenseg_value(int v, unsigned bindots){ REGISTER( SEVENSEGBASE, 7 ) = int_to_7seg(v%10) | (bindots&8 ? 0x80:0x00); REGISTER( SEVENSEGBASE, 6 ) = int_to_7seg((v/10)%10) | (bindots&4 ? 0x80:0x00); REGISTER( SEVENSEGBASE, 5 ) = int_to_7seg((v/100)%10) | (bindots&2 ? 0x80:0x00); REGISTER( SEVENSEGBASE, 4 ) = int_to_7seg((v/1000)%10) | (bindots&1 ? 0x80:0x00);}static void test(){ REGISTER( SEVENSEGBASE, 7 ) = int_to_7seg(channel); REGISTER( SEVENSEGBASE, 6 ) = 0; REGISTER( SEVENSEGBASE, 5 ) = SEGF|SEGE|SEGB|SEGC|SEGG; REGISTER( SEVENSEGBASE, 4 ) = SEGA|SEGF|SEGE|SEGD;}static void hello(){ REGISTER( SEVENSEGBASE, 7 ) = SEGA|SEGF|SEGB|SEGE|SEGC|SEGD; REGISTER( SEVENSEGBASE, 6 ) = SEGF|SEGE|SEGD; REGISTER( SEVENSEGBASE, 5 ) = SEGA|SEGF|SEGE|SEGD|SEGG; REGISTER( SEVENSEGBASE, 4 ) = SEGF|SEGE|SEGB|SEGC|SEGG;}void loop(){ if (extcnt == 100) { //ledState = !ledState; for (int thisPin = 0; thisPin < buttonCount; thisPin++) { digitalWrite(ledPins[thisPin], digitalRead(buttonPins[thisPin])); } set_sevenseg_value(cnt,1); cnt++; extcnt = 0; } extcnt++; int i; pt_render(modfile, mod, buf, NULL, 2, 16 /* Samples */, 1, 16, 1); for (i=0;i<32;i+=2) { unsigned v = buf[i]; v += buf[i+1]<<8; //v += buf[i]<<16; //v += buf[i+1]<<24; v+=0x8000; while (audioBuffer.isFull()); audioBuffer.push(v); }}void _zpu_interrupt(){ // Play if (audioBuffer.hasData()) { unsigned v = audioBuffer.pop(); SIGMADELTADATA = v; } if (timeout!=0) timeout--; TMR0CTL &= ~(BIT(TCTLIF)); } Link to comment Share on other sites More sharing options...
neslekkim Posted February 19, 2013 Report Share Posted February 19, 2013 I would guess casual users who use papilio and this tool could use to learn the term SoC, isn't it quite a normal term for this today? Link to comment Share on other sites More sharing options...
Felix Posted February 19, 2013 Report Share Posted February 19, 2013 i was thinking Papilio Blocks or something similar. Link to comment Share on other sites More sharing options...
hamster Posted February 19, 2013 Report Share Posted February 19, 2013 Stick with the butterfly metaphor / brand. It works. Papilio Chrysalis-----------------------------------Engineer your own custom CPU Or something equally dramatic :-) Link to comment Share on other sites More sharing options...
mubase Posted February 20, 2013 Report Share Posted February 20, 2013 "Papilio-Schematica-duino" ?Schematicart-duino" ? Papilio Scheme n sculpt (lol) ..... Link to comment Share on other sites More sharing options...
Rob Posted February 21, 2013 Report Share Posted February 21, 2013 SketchDuino! OTOH, I might be delirious still, that flu was rough! Link to comment Share on other sites More sharing options...
brianv Posted February 28, 2013 Report Share Posted February 28, 2013 +1 for Papilio blocks. This name actually tells you something about the function of the tool, rather than tacking the "duino" moniker on yet another product. Link to comment Share on other sites More sharing options...
Jack Gassett Posted February 28, 2013 Author Report Share Posted February 28, 2013 Thank you all for the feedback on the name. Will keep mulling it over. Jack. Link to comment Share on other sites More sharing options...
1iDev Posted March 5, 2013 Report Share Posted March 5, 2013 I have downloaded the SoC project, was able to modify the schematic and add uart to wb slot 5. Created a bit file loaded it to the Papilio One(500). Using Zpuino Arduino 0100-Z-windows created simple blink test sketch. Select the correct com port, Board=ZPUnio on Papilio One(500), click on upload. Get initial message: Binary sketch size: 732 bytes (of a 27648 byte maximum). And Hangs.... let it sit there for 15 minutes. So I take a step back and started to replicate the example here and I pull the header files from github and I get these errors when verifying the sketch SoCLogicWingTest.cpp:120: warning: 'void test()' defined but not usedSoCLogicWingTest.cpp:128: warning: 'void hello()' defined but not usedSoCLogicWingTest.o(.text._Z5setupv+0x4a): In function `.L17':: undefined reference to `VGAZX'SoCLogicWingTest.o(.text._Z5setupv+0x50): In function `.L9':: undefined reference to `VGAZX_class::begin(unsigned int)'SoCLogicWingTest.o(.text._Z5setupv+0xa2): In function `.L19':: undefined reference to `pt_init_smallfs(SmallFSFile&)'SoCLogicWingTest.o(.text._Z5setupv+0xea): In function `.L19':: undefined reference to `VGAZX_class::loadscr(SmallFSFile&)'SoCLogicWingTest.o(.text._Z5setupv+0x11b): In function `.L19':: undefined reference to `pt_init_smallfs(SmallFSFile&)'SoCLogicWingTest.o(.text._Z4loopv+0x2b): In function `loop()':: undefined reference to `pt_render'SoCLogicWingTest.o(.text._Z4loopv+0x167): In function `.L63':: undefined reference to `pt_render'collect2: ld returned 1 exit statusmake: *** [soCLogicWingTest.elf] Error 1C:\projects\Tools\arduino-0100-Z-windows\arduino-0100-Z\hardware\tools\zpu\bin\make returned 2 Any thoughts? Link to comment Share on other sites More sharing options...
Jack Gassett Posted March 5, 2013 Author Report Share Posted March 5, 2013 Ah, sorry, this is a work in progress. It looks like the VGAZX libraries are not included with the ZPUino IDE release. Here is a zip file for the entire sketch including the libraries. Jack.logicstart_papilio_soc_total.zip Link to comment Share on other sites More sharing options...
1iDev Posted March 5, 2013 Report Share Posted March 5, 2013 Jack,No worries, that compiled... I have tried several things here, and I ultimately think this is a problem with the zpuino ide... I downloaded the zpuino bit file and loaded it to the board, and tried uploading a blink test and same issue the ide just hangs. Reading some other posts I even tried arduino-0102-windows same issue. this is all that happens The settings I have:Board=ZPUino on PapilioOne(500)Com=Com7(USB Serial Converter A) Link to comment Share on other sites More sharing options...
Jack Gassett Posted March 5, 2013 Author Report Share Posted March 5, 2013 Ah, this is an indication that the ZPUino is not responding properly. Have you loaded the ZPUino bit file you created to SPI Flash? That is the most likely culprit here... If that does not do the trick then start with a known good bit file. Attached is one that I had in my folder for the base Papilio SOC system. Jack.papilio_soc_base-working.bit Link to comment Share on other sites More sharing options...
1iDev Posted March 5, 2013 Report Share Posted March 5, 2013 Jack, I did write to SPI Flash. So I downloaded your bit file, loaded it and tried to load the sketch and still the same result. JTAG chainpos: 0 Device IDCODE = 0x41c22093 Desc: XC3S500EUsing devlist.txtJTAG chainpos: 0 Device IDCODE = 0x41c22093 Desc: XC3S500E Uploading "C:\Program Files (x86)\Gadget Factory\Papilio Loader\programmer\bscan_spi_xc3s500e.bit". Done.Programming time 183.0 ms Programming External Flash Memory with "C:\Downloads\papilio_soc_base-working.bit".Found SST Flash (Pages=2048, Page Size=264 bytes, 4325376 bits).Erasing :OkVerifying :.....PassProgramming :..............Finished ProgrammingOkVerifying :.....PassUsing devlist.txtDone.SPI execution time 5948.3 msUSB transactions: Write 2881 read 2164 retries 0JTAG chainpos: 0 Device IDCODE = 0x41c22093 Desc: XC3S500E Using devlist.txtISC_Done = 0ISC_Enabled = 0House Cleaning = 1DONE = 0 Link to comment Share on other sites More sharing options...
Jack Gassett Posted March 5, 2013 Author Report Share Posted March 5, 2013 Ahhhhh, I should have noticed this before, you are using the first serial port which is used for JTAG programming of the FPGA:Com=Com7(USB Serial Converter A) The ZPUino uses the second serial port in order to upload its code. So change to the second com port:Com=Com8(USB Serial Converter B ) I think that will solve your problem. Jack. Link to comment Share on other sites More sharing options...
kb1gtt Posted March 30, 2013 Report Share Posted March 30, 2013 Oops, wrong thread, disregard. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.