ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board

More
3 years 8 months ago - 3 years 8 months ago #264798 by deroj
Think am not far enough into this yet to write a module.
Is there a How To? :silly:
Is it Python? All I see is in C...

EDIT: Sorry...I found the folder with the Python Code example
Last edit: 3 years 8 months ago by deroj.

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #264976 by deroj
[url] github.com/enjoy-digital/litex/blob/mast...ex/soc/cores/uart.py [/url]

There is already an UART core in LiteX.
Can you use it out of the box?
My big quastion is, how is the assignment to a pin done?

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #265013 by romanetz
you can either assign them as pads as well as other pins or through multiplexers if you need runtime-configurable firmware
UART communication needs FIFOs and a kind of flow-control in driver and in firmware. In order to make Modbus communication possible (remember allowed delays and turnaround time)

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #265020 by TOLP2
As I look at the source code of Litex UART, I see even some code for UART to wishbone. This means you could send the same packages over UART as we now send over Ethernet and the card should still work. With Litex-CNC all you need would be a driver for the UART.

One challenge though would be the timings and speed. If anything like USB is used to create a serial port, this solution will not work in real-time. That's because of the nature of USB, any re-indexing or interrupt will cause a unacceptable delay on the port. However, it might be interesting for the UART on a RPI4, because you would be directly using the GPIO.

A bummer would be the speed of the UART. Let's assume a cycle period of 1 ms, or 1,000 updates per second. Every update consists of read (which starts with a write of the addresses to be read) and write. On average the read and write are something like 30 bytes; which means every cycle we have to transfer 100 bytes. This means the data-transfer required is 100 kb per second. The speed of UART is 115,200 baud tops, so in the best case scenario we can transmit is 14k4 bytes.

With the speed of UART it will be very difficult to send the required data to the FPGA. It might hamper the amount of functions / modules you want to have (128 GPIO only asks for four bytes and will most likely work) or the update speed / cycle period.

But I like the idea! Would love to have / write a driver for this.

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #265021 by romanetz
Litex has an udp streaming module and FIFOs, therefore, 2 simultaneous udp connections are needed: one is for etherbone exchange and another for serial communication. As long as realtime drivers work with polling principle, an user has to write another driver which works on user threads.

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago - 3 years 8 months ago #265028 by deroj
Maybe I think to easy.
But all I would use the UART for is to send bytes to a RS232 / RS485 converter and read bytes back from it. These data should be transfered together with the other data from / to LinuxCNC.

I do not want to control stepeers, encoders, etc over UART.
So maybe, the part from lines 54 to 150 looks like it takes the data byte and shift it right out to a fpga pin. And the "rx"pin into a data-byte.
  

EDIT:
I attached my component for the Mesa card, so maybe you know what I want.
It maybe not the perfect C programming, but it works :D
I changed the Bit-file, so the Mesa card has an UART and then I used the "mesa_uart.comp" to send and receive the bytes I need.

 

File Attachment:

File Name: vs500.comp
File Size:9 KB
Last edit: 3 years 8 months ago by deroj.
The following user(s) said Thank You: TOLP2

Please Log in or Create an account to join the conversation.

Moderators: PCW, jmelson
Time to create page: 0.144 seconds
Powered by Kunena Forum