Open gmenier opened 3 years ago
I too want to know this! I haven't figured it out yet but this is just a log of what I've got so far. I know pin P4 and P5 are tx and rx but also I'd love to know what the reset pin is too.
According to https://www.robot-electronics.co.uk/files/iceFUNdoc.pdf
10-bit A/D converters Accessed via serial commands to PIC CPU 250k baud, 1 start, 8 data, 1 stop, no parity Tx on in P4, Rx on pin P5 X1 - send command 0xA1 X2 - 0xA2 X3 - 0xA3 X4 - 0xA4 Receive 2 bytes, high byte first. Combine for 10 bit right justified result.
From my system it seems like this is over at /dev/ttyACM0 (I found this mostly by luck actually... this disappeared when I disconnected the board)
I used moserial to connect to this, at the recommended 1 start, 8 data, 1 stop, no parity.
I added
set_io --warn-no-port tx P4
set_io --warn-no-port rx P5
to my iceFUN.pcf and added the appropriate headers and outputs.
Changing blinky just a bit to use
always @ (posedge rx) begin
counter <= counter + 1;
end
as the counter.
And then sending over data at any speed results in nothing. I thought I'd at least get a couple here. It seems like transmitting data will be a bit trickier.
Instead using
assign {led8, led7, led6, led5, led4, led3, led2, led1} = rx[7:0] ^ 7'hff;
Does get me two leds lit up, but no further change. Seems like it comes from the initial connection..? I will have to check further.
I'm kinda stuck here actually, will try again in a bit.
One other problem I have is that after connecting to /dev/ttyACM1
or /dev/serial/by-id/usb-Devantech_Ltd._iceFUN_00000000-if00
I can't reprogram the fpga. I have to unplug/replug.
I think you're correct in saying serial is not passed through the USB. I've talked to some helpful people and they said that the PIC deals with the AD1, AD2, AD3 and AD4 pins. My guess is that these pins go to the PIC and then to the fpga, which is the "4 * 10-bit analogue channels" the PIC provides. And then the FPGA has to talk serial to the PIC in order to get these values. Which is a shame! So I think we'll have to use a seperate cable in order to get a serial communication from the PC to fpga.
Yes. Sorry for the late answer. I gave up and used a cheap FT232RL. No answers from the makers of iceFun. Neat fpga anyway.
I did send them an email and got a really quick reply (thanks Chris!)
Hi, There is no coms directly between the USB and FPGA. The connection between the FPGA and PIC is for doing A/D conversions. There is no connection between USB and FPGA. Whilst this could be added, unfortunately at this stage it would break backwards compatibility with existing applications using the A/D. There would be no way to tell if data was from the USB or A/D response. One option is to use a separate USB-Serial module like this one: https://www.robot-electronics.co.uk/usb-ser01.html Best Regards, Chris
I'm intrigued by "Whilst this could be added". (I assume something with reprogramming the PIC)
Anyway i found a serial USB cable as well so not too big of an issue for when debugging
too bad that the PIC firmware is not opensource, then you could build in the feature yourself
in case someone needs verilog code for the ADC: https://github.com/multigcs/riocore/tree/main/riocore/plugins/icewerxadc
Is it possible to output some serial thru the pic to the USB port ? The use of TX and RX (4 and 5) seems dedicated to the AN ports access - that is not echoed thru the pic to the USB (or so it seems)
Using a FTDI to USB extra converter connected to some pins is always possible of course but really a bad solution if the onboard USB is available thru FPGA pins. Is it ? Is the use of the PIC preventing a direct access to the USB for the FPGA ? by design ?
the IceFun is a very neat and affordable FPGA but as all FPGA, for debugging and design purposes, there should be a way to input / output some text thru the USB.
Can you help ? :-)
Thank you. G.