jamesbowman / swapforth

Swapforth is a cross-platform ANS Forth
BSD 3-Clause "New" or "Revised" License
275 stars 56 forks source link

PIO0/PIO2 (HDR1/HDR2) access on icestick? #25

Open harwoodr opened 8 years ago

harwoodr commented 8 years ago

I see in j1a.v that the pin headers on the board are defined... with addresses defined under "IO PORTS" but I can't seem to set them:

255 $0020 io! ok $0020 io@ . 255 ok 255 $0010 io! ok $0010 io@ . 27 ok

...am I missing something?

RGD2 commented 8 years ago

Confirmed, mine does the same thing. I don't think you're missing a step.

Hmm...

RGD2 commented 8 years ago

I think it's a timing issue of some sort... there's a kludgy workaround:

>-1 -1 $10 io! drop
  ok
>$10 io@ .
  255  ok

I hit the same behaviour with the j1a8k (with the leds on the hx8k breakout board), but it seemed to go away when I changed the LEDS to use a byte-wide ioport module instead of outpins .

I think it's something that merits an issue raised on cliffordwolf/icestorm - although he seems to be hard at work on icetime already, and we probably won't be able to figure out this issue until he's got it working well enough for us to see how the timing paths differ between the led's and the io ports.

RGD2 commented 8 years ago

Seems fixed now with cliffordwolf/yosys@840a6dc, cseed/arachne-pnr@1a4fdf9, cliffordwolf/icestorm@b49d2d3, jamesbowman/swapforth@ef9aaa6.

sudo python shell.py -h /dev/ttyUSB1 -p ../common/
Contacting... established
Loaded 207 words
>-1 leds
  ok
>0 leds
  ok
>-1 $20 io!
  ok
>$20 io@ .
 255  ok
>-1 $10 io!
  ok
>$10 io@ .
 255  ok