- Posts: 63
- Thank you received: 21
ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
- deroj
- Offline
- Senior Member
-
Less
More
3 years 8 months ago - 3 years 8 months ago #264798
by deroj
Replied by deroj on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
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
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.
- deroj
- Offline
- Senior Member
-
Less
More
- Posts: 63
- Thank you received: 21
3 years 8 months ago #264976
by deroj
Replied by deroj on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
[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?
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.
- romanetz
- Offline
- Senior Member
-
Less
More
- Posts: 51
- Thank you received: 45
3 years 8 months ago #265013
by romanetz
Replied by romanetz on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
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)
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.
- TOLP2
- Offline
- Elite Member
-
Less
More
- Posts: 225
- Thank you received: 178
3 years 8 months ago #265020
by TOLP2
Replied by TOLP2 on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
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.
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.
- romanetz
- Offline
- Senior Member
-
Less
More
- Posts: 51
- Thank you received: 45
3 years 8 months ago #265021
by romanetz
Replied by romanetz on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
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.
- deroj
- Offline
- Senior Member
-
Less
More
- Posts: 63
- Thank you received: 21
3 years 8 months ago - 3 years 8 months ago #265028
by deroj
Replied by deroj on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
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
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.
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

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.
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