YosysHQ / icestorm

Project IceStorm - Lattice iCE40 FPGAs Bitstream Documentation (Reverse Engineered)
ISC License
965 stars 224 forks source link

RS-232 on ice40 UP5k #284

Closed fmahnke closed 1 year ago

fmahnke commented 2 years ago

Hi, please excuse me if this isn't the right place to ask this. I'm new to FPGAs and not sure if my question is related to icestorm/iceprog or just a question about my board.

I have an ice40 up5k breakout board and would like to do RS-232 over the USB cable. This was easy on my icestick, which dedicates one of the FTDI's interfaces to RS-232 pins. I'm stumped getting it to work on my up5k board.

Looking at the UP5k board, schematic, I see interface A's TX/RX pins are connected to the SPI pins SCK and SI. So I thought if I'm not using SPI, I can use those pins for my serial communication.

I shunted the programming shunts vertically and removed the J7 shunt to disable flash.

Then I wrote my verilog code with SCK as the rx pin and SI as the tx pin. I synthesized and programmed the board with yosys/nextpnr, and I verified the board is transmitting data by probing the SI pin.

On the computer side, I see no incoming data on the /dev/ttyUSB? device exposed from the FTDI driver. Nor do I see the board receiving data when I send it from the computer. I also tried to connect to the device with a C program using libftdi. That program connects to the FTDI device successfully, but again, no data going back and forth from its perspective.

I connected the SCK/SI pins to another DB-9/USB cable with an internal FTDI device, and when I do that, I see data going over the line, so I think the verilog implementation is not the problem.

I noticed the same behavior as https://github.com/YosysHQ/icestorm/issues/194. I followed the steps in that issue to re-bind the device, but no progress.