- Posts: 51
- Thank you received: 0
ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
4 years 5 months ago #242571
by romanetz
Replied by romanetz on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
No, my plan was just to compile colorcnc firmware for Xilinx platform. A lot of changes is needed to original firmware to implement Mesa on RV901T platform: at least, move here udp/ip stack, say as from Alex Forencich github:
github.com/alexforencich/verilog-ethernet
Now about uncommanded motion. I consider that it's necessary to implement some kind of a state machine like in ethercat: IDLE-> (transition by command) PREOPerational<->SAFEtyOPerational (process data available, no control) <-> (forward transition by command, backward transition by timeout) OPerational
And all boards must follow such set of a predefined commands. Say like in left corner of the attachment.
Now about uncommanded motion. I consider that it's necessary to implement some kind of a state machine like in ethercat: IDLE-> (transition by command) PREOPerational<->SAFEtyOPerational (process data available, no control) <-> (forward transition by command, backward transition by timeout) OPerational
And all boards must follow such set of a predefined commands. Say like in left corner of the attachment.
Please Log in to join the conversation.
4 years 5 months ago #242585
by TOLP2
Replied by TOLP2 on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
Thanks for the poster, that is a nice one to keep in mind for further improvements.
At this moment there is a state machine in LitexCNC (not in the original colorcnc), however it is simpler then the EtherCAT one:
So: safety is in the design of LitexCNC and I really do appreciate people actively seeking for safety!
At this moment there is a state machine in LitexCNC (not in the original colorcnc), however it is simpler then the EtherCAT one:
- IDLE: Watchdog is timed out, all inputs / outputs are in safe state and the stepgens are stopped;
- INIT: The master requests header information to verify the configuration of the card and firmware. The watchdog is still timed out and the outputs stay in safe state and stepgen stopped.
- RESET: The master sends the reset signal to the FPGA and verifies it has been correctly received. This ensures the stepgen counters are reset to a known state, preventing uncommanded moves when the HAL-cycle starts sending data. The watchdog is still timed out.
- ACTIVE: The master reads data from the FPGA, processes it (by using other components) and at the end of the cycle sends the commands back to the FPGA. The watchdog is being petted and after a pre-defined time-out (1,5 ms in the examples)
- WATCHDOG_BITTEN: When the watchdog times out the inputs and outputs go to safe state and the stepgens are stopped. Depending on the settings, the stepgens are stopped gently (with keeping acceleration limits in mind) or harsh (stop direct).
So: safety is in the design of LitexCNC and I really do appreciate people actively seeking for safety!
Please Log in to join the conversation.
4 years 5 months ago #243112
by TOLP2
Replied by TOLP2 on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
Small update:
While developing I found a few bugs which need to be resolved: when no GPIO, PWM or Stepgen is defined, the firmware crashes as it is trying to create a register with a width of 0. At this moment at least one of each have to be defined. When the encoder driver software is finished, I'll tackle this problem as well.
Another nice feat: I'm making a hat for the RV901T, so all the stepper drives, switches and user input can be connected easilty. This board also contains a FTDI232 chipset so it can be reprogrammed on the fly.
- the firmware is now supporting RV901T and the various ColorLight cards;
- the firmware is expanded with the support for encoders (up to 32
). This new module has a different layout then the previous layouts, making it faster and more concise to develop; - the target of this project is known: my Emco5 will become the test-bed for this firmware, an example of the config is given below. Have to say, it makes the configuration as easy as it can get.
Code:
{
"board_name": "test_PWM_GPIO",
"baseclass": "firmware.boards.RV901T",
"clock_frequency": 50000000,
"ethphy": {
"tx_delay": 0
},
"etherbone": {
"ip_address": "10.0.0.10",
"mac_address": "0x10e2d5000000"
},
"gpio_in": [
{
"name": "rapid_override_reset",
"pin":"J601:7"
},
{
"name": "feed_override_reset",
"pin":"J601:8"
},
{
"name": "spindle_override_reset",
"pin":"J601:9"
}
],
"gpio_out": [
{
"name": "rapid_override_active",
"pin":"J601:15"
},
{
"name": "feed_override_active",
"pin":"J601:16"
},
{
"name": "spindle_override_active",
"pin":"J601:17"
},
{
"name": "stepgen_shared_enable",
"pin":"J600:39"
}
],
"pwm": [
{
"name": "test_otherwise_no_compile",
"pin":"J601:36"
}
],
"stepgen": [
{
"name": "stepgen_0",
"step_pin": "J600:38",
"dir_pin": "J600:36",
"soft_stop": true
},
{
"name": "stepgen_1",
"step_pin": "J600:34",
"dir_pin": "J600:32",
"soft_stop": true
},
{
"name": "stepgen_2",
"step_pin": "J600:37",
"dir_pin": "J600:35",
"soft_stop": true
},
{
"name": "stepgen_3",
"step_pin": "J600:33",
"dir_pin": "J600:31",
"soft_stop": true
}
],
"encoders": [
{
"name": "rapid_override",
"pin_A": "J601:7",
"pin_B": "J601:8"
},
{
"name": "feed_override",
"pin_A": "J601:9",
"pin_B": "J601:10"
},
{
"name": "spindle_override",
"pin_A": "J601:11",
"pin_B": "J601:12"
},
{
"name": "MPG",
"pin_A": "J601:13",
"pin_B": "J601:14"
}
]
}
While developing I found a few bugs which need to be resolved: when no GPIO, PWM or Stepgen is defined, the firmware crashes as it is trying to create a register with a width of 0. At this moment at least one of each have to be defined. When the encoder driver software is finished, I'll tackle this problem as well.
Another nice feat: I'm making a hat for the RV901T, so all the stepper drives, switches and user input can be connected easilty. This board also contains a FTDI232 chipset so it can be reprogrammed on the fly.
Please Log in to join the conversation.
4 years 5 months ago #243152
by romanetz
Replied by romanetz on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
Which version of Xilinx tools do you use?
Please Log in to join the conversation.
4 years 5 months ago #243161
by nickXX
Replied by nickXX on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
TOLP2, are you planning to create a wiki and release the files fotr the hat, when it's ready?
I can solder and have the experience with programming different chips, but as for the colorcnc, it's pretty hard for me to understand what's going on and what needs to be done ...
Guess a few of us are open to donating, to motivate your work further ..
I can solder and have the experience with programming different chips, but as for the colorcnc, it's pretty hard for me to understand what's going on and what needs to be done ...
Guess a few of us are open to donating, to motivate your work further ..
Please Log in to join the conversation.
4 years 5 months ago #243275
by TOLP2
Replied by TOLP2 on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
@ramonetz: At this moment I've downloaded version 13.6 for Windows. The space requirements for the latest version of the studio seems a little bit too crazy with 15+ Gb. I also saw it has been renamed to Vivaro.
With the version I've installed I didn't have luck yet to produce a bit-file which seems to work on my RV901T. I did upload the bit-file for blinking the LED and this worked, so I know for sure my JTAG-hack on the board worked. Have to say the toolchain for the 5a-75E (josys) is much more friendly and imposing on a starting user.
@nickXX: all files are available on my github . Within the README-file I want to put all the information to upload the firmware and on how to compile the driver. The first part I still have to write, the latter has been doen (although it can use some expansion on the pins). Because I'm now supporting two different board-types (Colorlight / EPC and RV901T / Xilinx) and it turns out they require different toolchains, I like your idea to convert the README to a wiki.
The design for the hat will also be published in the repository. It will be made in KiCad. The design will not be very refined, because':
With the version I've installed I didn't have luck yet to produce a bit-file which seems to work on my RV901T. I did upload the bit-file for blinking the LED and this worked, so I know for sure my JTAG-hack on the board worked. Have to say the toolchain for the 5a-75E (josys) is much more friendly and imposing on a starting user.
@nickXX: all files are available on my github . Within the README-file I want to put all the information to upload the firmware and on how to compile the driver. The first part I still have to write, the latter has been doen (although it can use some expansion on the pins). Because I'm now supporting two different board-types (Colorlight / EPC and RV901T / Xilinx) and it turns out they require different toolchains, I like your idea to convert the README to a wiki.
The design for the hat will also be published in the repository. It will be made in KiCad. The design will not be very refined, because':
- my soldering iron and my skills do not suite SMD well, I lack experience;
- my preference is to make the hat with my router (own production), which also limits the minimum size of the pads. I have to do some experiments on how small I can go.
Please Log in to join the conversation.
4 years 5 months ago #243327
by romanetz
Replied by romanetz on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
Well. I managed to compile my version of firmware for RV901T. Still not sure if all timing constraints are met, because I'm not very good with ISE. Today I'll make some tests.
Please Log in to join the conversation.
4 years 5 months ago #243347
by TOLP2
Replied by TOLP2 on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
Romanetz, can you please give some guidance how you managed to compile:
- which version of ISE did you use?
- did you only use the verilog code produced by Litex, or did you need any other file as well.
Would love to se a screenshot of your ISE environment.
Edit: after some tinkering I managed to compile the firmware for the board. Turns out Litex dumps some erronous clock constraints at the end of the file. I've deleted those lines and now it compiles. I can read the magic and reset the board. However, as soon as I start reading data from the board, it stops working
. Have made some changes to the firmware, so I have to cross-reference with the 5A-75E to see whether the problem is board specific or that I broke the firmware...
Edit 2: In the branch encoder I have now a working firmware and driver which supports the modules GPIO, PWM/PDM, stepgen en encoders. Now it is time to write down for everybody how to hook this thing up for their specific setup and perform some tests. I suck at soldering SMD, still have to test anything with inputs...
- which version of ISE did you use?
- did you only use the verilog code produced by Litex, or did you need any other file as well.
Would love to se a screenshot of your ISE environment.
Edit: after some tinkering I managed to compile the firmware for the board. Turns out Litex dumps some erronous clock constraints at the end of the file. I've deleted those lines and now it compiles. I can read the magic and reset the board. However, as soon as I start reading data from the board, it stops working
Edit 2: In the branch encoder I have now a working firmware and driver which supports the modules GPIO, PWM/PDM, stepgen en encoders. Now it is time to write down for everybody how to hook this thing up for their specific setup and perform some tests. I suck at soldering SMD, still have to test anything with inputs...
Please Log in to join the conversation.
4 years 5 months ago #243468
by muvideo
Replied by muvideo on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
Hi,
I'd like to try your implementation on real hardware.
Maybe I lost something but I'm having difficulty to build the firmware.
I have latest Litex on my machine (Ubuntu 20.04 python 3.8.10).
once cloned the branch "envoders" from your repository in my home directory
then
It fails with this message:
So I'm making some mistake, what is the supposed way to build the firmware?
Thanks.
I'd like to try your implementation on real hardware.
Maybe I lost something but I'm having difficulty to build the firmware.
I have latest Litex on my machine (Ubuntu 20.04 python 3.8.10).
once cloned the branch "envoders" from your repository in my home directory
then
Code:
cd LiteX-CNC/
python3 -m firmware examples/5a-75e-hello-gpio.json
It fails with this message:
Code:
File "/home/fabio/LiteX-CNC/firmware/soc.py", line 86, in __init__
super().__init__(config)
File "/home/fabio/LiteX-CNC/firmware/boards/colorlight.py", line 66, in __init__
super().__init__("5a-75b", "6.0", config, sys_clk_freq)
File "/home/fabio/litex/litex/litex/soc/integration/soc_core.py", line 386, in __init__
SoCCore.__init__(self, *args, **kwargs)
File "/home/fabio/litex/litex/litex/soc/integration/soc_core.py", line 121, in __init__
LiteXSoC.__init__(self, platform, clk_freq,
File "/home/fabio/litex/litex/litex/soc/integration/soc.py", line 747, in __init__
self.logger.info("FPGA device : {}.".format(platform.device))
AttributeError: 'str' object has no attribute 'device'
So I'm making some mistake, what is the supposed way to build the firmware?
Thanks.
Please Log in to join the conversation.
4 years 5 months ago #243573
by TOLP2
Replied by TOLP2 on topic ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board
Thanks for trying it out. You didn't do anything wrong, you found a bug in initializing the colorlight-board. I fixed the problem I would like to ask you to please test again.
The supported board types are:
The supported board types are:
- 5A-75B:
- version 6.1:
Code:"baseclass": "firmware.boards.ColorLight_5A_75B_V6_1"
- version 7.0:
Code:"baseclass": "firmware.boards.ColorLight_5A_75B_V7_0"
- version 8.0:
Code:"baseclass": "firmware.boards.ColorLight_5A_75B_V8_0"
- version 6.1:
- 5A-75E:
- version 6.0 (can also be used for version 8.0):
Code:"baseclass": "firmware.boards.ColorLight_5A_75E_V6_0"
- version 7.1:
Code:"baseclass": "firmware.boards.ColorLight_5A_75E_V7_1"
- version 6.0 (can also be used for version 8.0):
- RV901T:
Code:"baseclass": "firmware.boards.RV901T"
Please Log in to join the conversation.
Time to create page: 0.233 seconds
