Shop Learn
Propeller II: Emulation of the P2 on FPGA boards (Prop123-A7/A9, DE0-NANO, DE2-115, etc) - Page 15 — Parallax Forums

Propeller II: Emulation of the P2 on FPGA boards (Prop123-A7/A9, DE0-NANO, DE2-115, etc)

1121315171824

Comments

  • Bill HenningBill Henning Posts: 6,445
    edited 2012-12-20 09:29
    David,

    Easiest way to save the Nano pins is to use a 74HC04 (or any other HC series buffer (inverting or not) with enough current source/sink for LED's depending on how you want to hook up the LED's) as an inverting buffer.

    Use a current limiting resistor to limit LED's to 8mA each, then you will be within the spec of the chip even when using six LED's.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-20 09:37
    Hi.

    Terasic use 120R resistors to sinking correct on theirs LED's connected directly to FPGA
  • Bill HenningBill Henning Posts: 6,445
    edited 2012-12-20 09:43
    Thanks Sapieha!

    I wonder what the Vfd and minimum current is for the LED's they use - with that, we could calculate what the *real* safe current limit is for the pins; I suspect the 2mA / 4mA in the Altera data sheet is extremely conservative.
    Sapieha wrote: »
    Hi.

    Terasic use 120R resistors to sinking correct on theirs LED's connected directly to FPGA
  • ctwardellctwardell Posts: 1,714
    edited 2012-12-20 11:22
    Did someone mention using a second prop plug for the terminal?

    I seem to recall seeing that but can't find the post.

    It looks like I could connect the second one on the Vss P26, P28, P30 spot on a DE0-Nano.

    I wonder what the pin states are from the FPGA during programming and reset.

    I'd like to do that so I don't have to re-enable the terminal everytime I load a new program.

    I went ahead and ordered a 2nd prop plug from Digi-Key. I'm hoping maybe they play Santa and send me a DE2-115 by accident.

    C.W.
  • potatoheadpotatohead Posts: 10,196
    edited 2012-12-20 11:38
    I am on a phone, and linking is not something I want to do.

    Visit my blog, the most recent entries contain what you are looking for.

    Works great, just make sure your lower com port numbered prop plug is the programming one.

    The monitor reference in progress has serial setup info and connect pictures as well.
  • ctwardellctwardell Posts: 1,714
    edited 2012-12-20 11:47
    potatohead wrote: »
    I am on a phone, and linking is not something I want to do.

    Visit my blog, the most recent entries contain what you are looking for.

    Works great, just make sure your lower com port numbered prop plug is the programming one.

    The monitor reference in progress has serial setup info and connect pictures as well.

    Thanks Doug, I knew I had seen it somewhere.

    My second Prop Plug should get here Saturday.

    C.W.
  • AribaAriba Posts: 2,504
    edited 2012-12-20 13:40
    ctwardell wrote: »
    ....
    I'd like to do that so I don't have to re-enable the terminal everytime I load a new program.
    ...

    Have you tried the PropTerminal (1 page back in this thread)? It is made for fast and easy switching between the IDE (PNUT.exe here) and the Terminal. Normally I have the Terminal window open over the PNUT text. To change the PASM code I minimize PropTerminal, which also closes the COM port. After compiling and loading the new code, just click on PropTerminal in the Taskbar and it appears again in foreground and opens also the COM port.

    Andy
  • ctwardellctwardell Posts: 1,714
    edited 2012-12-20 13:43
    Ariba wrote: »
    Have you tried the PropTerminal (1 page back in this thread)? It is made for fast and easy switching between the IDE (PNUT.exe here) and the Terminal. Normally I have the Terminal window open over the PNUT text. To change the PASM code I minimize PropTerminal, which also closes the COM port. After compiling and loading the new code, just click on PropTerminal in the Taskbar and it appears again in foreground and opens also the COM port.

    Andy

    I'll give it a try, thanks Andy.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-20 13:45
    Hi Andy.

    I don't minimise PropTerminal window --- PNut compiles code anyway even if it don't find COMx port.

    And as I use Yours File/Upload file menu in PropTerminal window --- No need for PNut to download it.



    Ariba wrote: »
    Have you tried the PropTerminal (1 page back in this thread)? It is made for fast and easy switching between the IDE (PNUT.exe here) and the Terminal. Normally I have the Terminal window open over the PNUT text. To change the PASM code I minimize PropTerminal, which also closes the COM port. After compiling and loading the new code, just click on PropTerminal in the Taskbar and it appears again in foreground and opens also the COM port.

    Andy
  • AribaAriba Posts: 2,504
    edited 2012-12-20 13:49
    My setup:

    - DE0-NANO
    - PropTerminal
    - 2 channel Scope (60MHz BW)
    - custom made PropPlug with additional 5V output - used to power the DE0-Nano

    I have also made an adapter with a 10pin standard connector. I have a lot of modules for that from Prop1 which can be used also with Prop2. For example:
    - Bluetooth module
    - LCD (Nokia3310)
    - 128kByte SPI-Ram
    - 8 LEDs

    Andy
  • AribaAriba Posts: 2,504
    edited 2012-12-20 13:52
    Sapieha wrote: »
    Hi Andy.

    I don't minimise PropTerminal window --- PNut compiles code anyway even if it don't find COMx port.

    And as I use Yours File/Upload file menu in PropTerminal window --- No need for PNut to download it.

    Yeah that is another methode, but I think it needs a bit more clicks: Menu, Upload, Select File, Okay. Makes 4 clicks compared to one ;-)

    Andy
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-20 13:58
    Hi Andy..

    Still more usable for me.

    I'm most interested in HEX code Yours terminal program show --
    That spare me some clicks in Monitor to stop code I loaded and then write all that needs for show it in Monitor

    It is why I asked If You have possibility to add
    Log-sesion to file ---- menu.



    Ariba wrote: »
    Yeah that is another methode, but I think it needs a bit more clicks: Menu, Upload, Select File, Okay. Makes 4 clicks compared to one ;-)

    Andy
  • Cluso99Cluso99 Posts: 17,949
    edited 2012-12-20 15:22
    For LEDs...
    Use a superbright led (>8000mcd) and a 5K or 10K series resistor. Unless you are in a very bright environment, or the pulsing is too fast, you will easily see this. I never use anything but superbright leds and a minimum of 3k3 resistors, but as I said mostly 10K. You cannot damage anything with a 10K resistor and it will almost never affect whatever else you are driving with it.
  • Cluso99Cluso99 Posts: 17,949
    edited 2012-12-20 21:44
    Just running now :)

    DE0-Nano
    Cluso's FT232 (my propplug) using a jumper cable from it to the power connector on the de0nano.
    Windows 7
    PropTerminal and Andy's sin/cos program.
  • ctwardellctwardell Posts: 1,714
    edited 2012-12-22 14:31
    Can someone post a link to the latest copy of PNUT?

    I thought I had the latest, but it won't accept the single parameter version of REPD, says I need a comma.

    For reference my copy of PNUT.exe is dated 2012-12-10 18:05

    Thanks,

    C.W.
  • Cluso99Cluso99 Posts: 17,949
    edited 2012-12-23 02:41
    The one I downloaded is referenced in the first post of this thread. I updated a day or 2 ago with a link to the post where Chip has been updating the latest pnut.exe. My pnut.exe created date shows as 4 Dec 2012 at 4:19pm. I had thought there should have been a later one than this.
  • Cluso99Cluso99 Posts: 17,949
    edited 2012-12-23 19:14
    Ariba: re your PropTerminal...
    I presume to the xxx.obj is just a straight binary file like the PropTool outputs?
    If so, would it be possible for you to modify this so that we can download a binary 'blob' to hub with an offset?

    WHat I am preparing to do is create a P1 spin object that I can relocate to a fixed location in hub (say $4000 because I need it to be within the first 32KB due to P1 spin restrictions). Then I can download the P2 spin interpreter to the beginning of hub (as per normal) and just fix an offset into spin2 to start testing it out.

    DOes anyone have any better ideas that might use something already done???
  • David BetzDavid Betz Posts: 14,385
    edited 2012-12-24 16:30
    A while ago I posted the results of running fibo compiled with PropGCC on the P2. At the time I had to manually link in specially modified C support files because I hadn't yet taught propeller-elf-gcc to recognize the -mp2 option and use a P2-specific library and linker script. I've done that now and am able to run an unmodified version of fibo.c. Here is the result of running it on my DE2-115 board. The propgcc modifications are checked into Google Code under the "p2test" branch. You'll also need p2load to load the program into your DE0-Nano or DE2-115 FPGA board. Not very much of the low-level library is working yet. I'll be working on that next.
    david-betzs-macbook-pro:p2 dbetz$ make
    propeller-elf-gcc -Os -mp2 -mno-fcache -c fibo.c -o fibo.o
    propeller-elf-gcc -Os -mp2 -mno-fcache -o fibotest.elf fibo.o
    propeller-elf-objcopy -O binary fibotest.elf fibotest.bin
    david-betzs-macbook-pro:p2 dbetz$ make run
    p2load -v -s -h fibotest.bin -t
    Trying /dev/cu.usbserial-A700fKXl                    
    Found propeller version 32
    Loading 'fibotest.bin' on port /dev/cu.usbserial-A700fKXl
    ..............
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    hello, world!
    fibo(00) = 000000 (00000ms) (320 ticks)
    fibo(01) = 000001 (00000ms) (320 ticks)
    fibo(02) = 000001 (00000ms) (608 ticks)
    fibo(03) = 000002 (00000ms) (896 ticks)
    fibo(04) = 000003 (00000ms) (1472 ticks)
    fibo(05) = 000005 (00000ms) (2336 ticks)
    fibo(06) = 000008 (00000ms) (3776 ticks)
    fibo(07) = 000013 (00000ms) (6080 ticks)
    fibo(08) = 000021 (00000ms) (9824 ticks)
    fibo(09) = 000034 (00000ms) (15872 ticks)
    fibo(10) = 000055 (00000ms) (25664 ticks)
    fibo(11) = 000089 (00000ms) (41504 ticks)
    fibo(12) = 000144 (00000ms) (67136 ticks)
    fibo(13) = 000233 (00001ms) (108608 ticks)
    fibo(14) = 000377 (00002ms) (175712 ticks)
    fibo(15) = 000610 (00003ms) (284288 ticks)
    fibo(16) = 000987 (00005ms) (459968 ticks)
    fibo(17) = 001597 (00009ms) (744224 ticks)
    fibo(18) = 002584 (00015ms) (1204160 ticks)
    fibo(19) = 004181 (00024ms) (1948352 ticks)
    fibo(20) = 006765 (00039ms) (3152480 ticks)
    fibo(21) = 010946 (00063ms) (5100800 ticks)
    fibo(22) = 017711 (00103ms) (8253248 ticks)
    fibo(23) = 028657 (00166ms) (13354016 ticks)
    fibo(24) = 046368 (00270ms) (21607232 ticks)
    fibo(25) = 075025 (00437ms) (34961216 ticks)
    fibo(26) = 121393 (00707ms) (56568416 ticks)
    
  • David BetzDavid Betz Posts: 14,385
    edited 2012-12-24 16:55
    And one more thing, ebasic is now working so we have at least one version of Basic running on P2. Unfortunately, ebasic will only run on the DE2-115 board because it needs more than 32k of hub memory. In fact, propgcc by default will only run on the DE2-115 board because it assumes there is 128k of hub memory.
    david-betzs-macbook-pro:ebasic dbetz$ p2load -v -s -h ebasic.bin -t
    Trying /dev/cu.usbserial-A700fKXl                    
    Found propeller version 32
    Loading 'ebasic.bin' on port /dev/cu.usbserial-A700fKXl
    .................................................
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    ebasic 0.001
    10 for x=1 to 10
    20 print x, x*x
    30 next x
    run
    H:0 O:1 D:112 V:1 T:120
    1	1
    2	4
    3	9
    4	16
    5	25
    6	36
    7	49
    8	64
    9	81
    10	100
    OK
    
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-12-24 17:32
    Great work, David!

    My DE0 should show up this week so I can play along some. I couldn't justify the DE2 at this time for what I do. Hopefully by the time I need it, the real P2s will be available.

    EDIT: Boo hoo......my NANO is stuck in the snow!!! We're bordering on blizzard conditions here for the next 24 hours or so. :frown:



    Location Date Local Time Activity

    Middleburg Heights, OH, United States
    12/26/2012
    2:40 P.M.
    Emergency conditions beyond UPS' control.




    12/26/2012
    7:19 A.M.
    Out For Delivery


  • David BetzDavid Betz Posts: 14,385
    edited 2012-12-26 12:20
    Does anyone know the status of the Parallax board for the DE2-115 FPGA board? Will it have an SD slot?
  • potatoheadpotatohead Posts: 10,196
    edited 2012-12-26 13:23
    I know the boards went to fab sometime last week. I don't know about SD.
  • David BetzDavid Betz Posts: 14,385
    edited 2012-12-26 13:25
    potatohead wrote: »
    I know the boards went to fab sometime last week. I don't know about SD.
    I hope so since I need to get the SD support working in PropGCC.
  • jazzedjazzed Posts: 11,803
    edited 2012-12-26 23:40
    @Cluso99,

    I just wanted to say thanks for keeping your first post up-to-date with the latest information.

    Because of your efforts, today I was able to easily find the right programming tool/device driver set, reprogram my DE2 board with the P2 code, build C programs using David's P2 GCC changes, and load/run the programs using David's p2load tool.

    So again, thanks for your efforts.
    --Steve

    BTW ... and thanks to David for making 3 programming languages so far (beyond P2ASM) work on the P2 dev boards.
  • Cluso99Cluso99 Posts: 17,949
    edited 2012-12-27 01:14
    Thanks Steve. It also worked for me when I finally received my DE0-nano board. But none of this would be possible without Chip releasing the binaries, and everyone who has contributed various parts too.

    I have used Andy's PropTerminal and David's P2load. Both work fine :)
  • David BetzDavid Betz Posts: 14,385
    edited 2012-12-27 05:20
    Cluso99 wrote: »
    Thanks Steve. It also worked for me when I finally received my DE0-nano board. But none of this would be possible without Chip releasing the binaries, and everyone who has contributed various parts too.

    I have used Andy's PropTerminal and David's P2load. Both work fine :)
    Yes, Chip's offering of the FPGA configuration files was amazing! Thanks very much Chip!!
  • David BetzDavid Betz Posts: 14,385
    edited 2012-12-30 16:47
    I'm not sure if anyone has tried the propgcc "p2test" branch yet but I wanted to let you know that I've checked in a new version of gas that I believe implements all of the P2 instructions. If you decide to download propgcc sources to try this branch you should build using the jbuild2.sh script instead of jbuild.sh because the C++ compiler currently will not build with the -mp2 option. I'll be looking at that next.

    This version of propgcc will compile the demos/fibo/p2 demo as well as the demos/ebasic demo if you use the Makefile.p2 makefile. I suspect it will build other demos as well but those are the only ones I've tested so far. The P2 library doesn't support SD card access yet because I don't have the SD card slot connected on my DE2-115 FPGA board.

    If there is interest in trying this version of propgcc I can build a Windows version if that will help.
  • potatoheadpotatohead Posts: 10,196
    edited 2012-12-30 17:07
    l would love to work with this. A windows build would help a lot.
  • David BetzDavid Betz Posts: 14,385
    edited 2012-12-30 17:09
    potatohead wrote: »
    l would love to work with this. A windows build would help a lot.
    Okay, I'll build one tonight. Just to be clear though, this will be a command-line version. SimpleIDE has not been updated to handle building P2 programs as far as I know.
  • potatoheadpotatohead Posts: 10,196
    edited 2012-12-30 17:13
    Command line is fine. I don't need the IDE. Plenty of time for that later on. I am working on a fairly vanilla XP machine right now.
Sign In or Register to comment.