Parallax P2-EVAL (P2ES chip) pcb demo code
Cluso99
Posts: 18,069
I thought I would start a thread just for demo code that runs on the Parallax P2-EVAL board (with the P2-ES chip).
Here is demo code to setup the crystal oscillator to 180MHz and drive the serial port using the ROM Monitor/Debugger. Note the actual P2ASM code is tiny. Setup your serial terminal (via USB) to 115,200 baud - I use PST (Parallax Serial Terminal).
This is the assembler code portion. The remainder is just equates.
Here is demo code to setup the crystal oscillator to 180MHz and drive the serial port using the ROM Monitor/Debugger. Note the actual P2ASM code is tiny. Setup your serial terminal (via USB) to 115,200 baud - I use PST (Parallax Serial Terminal).
This is the assembler code portion. The remainder is just equates.
DAT orgh 0 org 0 '+-------[ Set Xtal ]----------------------------------------------------------+ entry hubset #0 ' set 20MHz+ mode hubset ##_SETFREQ ' setup oscillator waitx ##20_000_000/100 ' ~10ms hubset ##_ENAFREQ ' enable oscillator '+-----------------------------------------------------------------------------+ waitx ##_clockfreq*5 ' just a delay to get pc terminal running ''-------[ Start Serial ]------------------------------------------------------ mov lmm_bufad, ##_HUBBUF ' locn of hub buffer for serial routine mov lmm_x, ##_bitper ' sets serial baud call #_SerialInit ' initialise serial ''----------------------------------------------------------------------------- ' this code displays a version string (it's not required) mov lmm_p, ##hubstring ' must be in hub! call #_HubTxString .loop waitx ##_clockfreq ' just a delay before repeating mov lmm_x, #"Z" call #_HubTx jmp #.loop ''--------------------------------------------------------------------------------------------------- ''============[ COG VARIABLES - MONITOR]======================================== fit $1E0 ' ensure LMM reserved area cog $1E0-$1EF available ''--------------------------------------------------------------------------------------------------- ''============[ HUB VARIABLES ]================================================= DAT orgh $ hubstring byte "P2ES-EVAL-Demo-002",13,10 alignl ''---------------------------------------------------------------------------------------------------
Comments
Note: You will need to remove the .txt from the filename as the forum will not allow uploads with .BIX
However, I want to see TacOS loading without any program loaded first. It is a nice test for half a day. As soon as the board arrives, it will be done.
Kind regards, Samuel Lourenço
@Cluso99, thank you for the file, I put it on my SD card and was able to run the program. I received all the "zzzzzzzzzzz......." in the Parallax Serial Terminal. So that proves my board can run binary files. I still need to figure out how to compile and upload programs to my P2-EVAL board.
But, then I have no idea what I should be doing?
OK, I was able to get p58 blink using "PNut_v32i.exe"
The 20ms is actually closer to 80ms due to timing difference between RCFAST and 80MHz FPGA (same with the 20 ms)
BTW - I haven't got a P2-ES board but I could hook up some leds on my P2D2 and video it.
Breakdown of that code:
Demonstrates some of P2's instructions too.
I don't why this is not working on my P2ES-EVAL board.
All of these work:
56 blink
57 blink
58 blink
59 blink
60 blink
61 blink
62 blink
63 blink
Note: On December 25, 2018, I tried the above TAQOZ line of code and it blinks the LEDs on my P2ES-EVAL board correctly (I must have been typing in the line wrong before).
The above does not compile.
On this line "led" gets highlighted and I get the error "Undefined symbol."
[code]add led,cog 'led pin 56 to 63[/code]
Code works fine was a cut and paste problem
I not 1 (eye not one)
ADO not AD0 (much ADO about nothing)
Always have at least one whitespace between words and numbers
I reckon you might not have the correct Pnut.exe
It works fine on mine, which is version 32i (click Help to check version)
What version of Pnut are you using?
I am using "PNut_v32i.exe"
maybe just type them
dat org
led long 56
Same here, Version 32i
I think the idea is to start on RCFAST which is the reset default, and the first hubset is likely there to cover paths other than reset.
Then, you enable the Xtal oscillator, but do not yet enable the PLL output drive to SysCLK, then pause to allow Xtal to start, and pll to settle/lock.
Finally, enable PLL VCO/divp to drive SysCLK.
It's likely you could skip some hubsets and waits, but then you expose the P2 clock tree to an unlocked PLL (ie could be any MHz)
Lacking in P2 is any clock present or pll locked check, so the delay and hope is how it is coded.
@JonnyMac , your program runs great.