Page 33 of 41
Posted: Tue Apr 14, 2015 6:40 pm
I have older board with PIC32MX764, will be this board usable on RPI2 with MachineKit?
Or did you stop development for 764?
Posted: Tue Apr 14, 2015 10:18 pm
The old HAL driver still works.
You can also port the current PICnc-V2 code to work with 764. It won't be difficult as the uC is from the same family.
Posted: Sun May 03, 2015 12:47 am
Hi everyone. I was eying CNC machines for a while (even bought a set of stepper motors and stuff once to build one). The stumbling block for finally going through with it was always that CNC programs only seemed to work with the parallel port. This had a number of problems for me and I guess I am not alone with at least some of those.
1) the parallel port is a dying breed
2) using the parallel port as GPIO is always troublesome (it was never designed for that purpose)
3) running true real time applications on ANY OS (including RTOS) is located somewhere between really difficult and impossible.
4) it would require me to have a full PC with keyboard and monitor etc. in the garage with the CNC machine and all the other dust and particle generating tools/machinery. Not to mention the space a PC would take up...
A little while ago I was looking for solutions again as I do about once a year or so. I figured perhaps a Linux solution may now run on the Pi. And sure enough someone has done the great deed and made it work. Thanks a LOT for the great work! Now all that would be needed is the official Pi touch screen (whenever that arrives...
Meanwhile I finally got a small CNC machine and just spent the day struggling with Mach3 on my PC to check out if the machine is working, only to end up tossing Mach3 to the can. The pulsing engine driver simply refuses to install correctly. So I wrote a quick hack Java program to generate pulses on the parallel port. At lest the machine responds on all three axes. My true hope is that this will be much less troublesome on the Pi. At least someone finally saw the light of day and moved the pulse generation off the host machine.
The next project will be making a copy of the PICnc-V2 parallel port adapter for the Pi. I will probably recreate a copycat of the existing design in DipTrace. One thing I am planning to change is to allow for a straight (40 pin) ribbon cable connection to the Pi2. There should also be a power connection on the board to optionally feed the Pi from a robust power supply through the ribbon cable, instead of a USB adapter. If there are any other ideas floating around for changes on that circuit please let me know. I will try to incorporate them as I go.
Posted: Sun May 03, 2015 2:41 am
You can make a HAT version so there's no need for cables.
The SPI cable must be kept as short as possible to avoid noise disrupting the communication.
Posted: Sun May 03, 2015 3:07 am
My hope was to make a small enclosure that looks more like an All-In-One computer, once the Pi touch screen is released. Meanwhile it will probably be a CTM (cobbled together mess). The point is that stacking boards together tends to build tall... Still, if the connector is oriented correctly it simply comes down to installing a socket or a header and it can be used either way. When using a ribbon cable I imagine the boards sitting side by side, with the ribbon being perhaps 2 - 5 cm long. Something else I would like to do is having the D-Sub located in line with the PI USB connector, so that all connectors will be accessible on the same side panel.
Now, that brings up another question: when making boards for myself I usually go with SMD, particularly when it comes to space saving designs. When designing boards that I might/will share with others that is much less of an option. On the other hand, using a PIC with more pins would give more breathing room with IO pins. At the moment I am studying the combination of status LED and E-STOP button...
Posted: Mon May 18, 2015 12:15 am
I just finished the PCB layout. Here is what ended up on the circuit:
- A verbatim copy of the original PICnc circuit minus the LEDs.
- A 40 pin header for a direct ribbon connection to the Raspberry Pi B+ and model 2.
- Power feed to the Raspberry Pi via the ribbon cable with protection.
- A power control circuit for safe shutdown. It allows the Raspberry Pi to turn off the power when the OS has completed the shutdown procedure.
- A connection for a power indicator LED.
- Two controlled LED connections via Raspberry Pi GPIO.
- A second PIC (same type).
The power control circuit handles direct AC input and is intended to power a 5V power supply integrated in the enclosure. The power supply is completely de-powered when off, so there is no standby consumption.
The second PIC is intended to perform scanning of a 5 x 8 key matrix (up to 40 keys). This could be used with a numeric key pad and/or custom keys. The second PIC also has provisions for an encoder wheel input. I received an encoder wheel just a few days ago, works real sweet! Communication with the Raspberry Pi is via the serial port (at 3.3V).
Implementing the PIC code should not be hard. Now the next question is how to interface the second PIC with LinuxCNC. I assume there is an interface for a jogging dongle. Any support would be much appreciated.
Posted: Mon May 18, 2015 7:12 am
If you can present your encoder as an HID device then it will be easy as there's already code that handles joysticks and similar devices. Otherwise you'll have to make your oen custom hal driver.
Posted: Mon May 18, 2015 12:58 pm
that sounds good. I don't have much experience in coding on Linux. Since a serial device does not register with the OS as a USB device does, the handling must be all in the application that receives the serial data. Do you have any background in implementing such drivers or info you could point me to?
I want to do some circuit review and tinkering with the layout this week and order PCBs by the end of the week. Given turn around time on the PCB and parts, PCB assembly etc. I guess I may have a first incarnation of the controller code running in about three to four weeks...
Posted: Tue May 19, 2015 7:32 am
I haven't worked with serial devices under LinuxCNC/Machinekit.
Head over to https://groups.google.com/forum/#!forum/machinekit
and I'm sure someone will give you a hint on how to proceed.
Posted: Wed May 20, 2015 4:14 am
Thanks, I'll check that out. If a program running on Linux can register as a HID device, how it gets the data does not really matter (USB, Serial, I2C etc.). I will see.
There is just one thing I would like to confirm before I have boards made. For the SPI chip select line I use SPI_CE0_N (also GPIO8, pin 24 on the Pi header). Is that correct? On the PICnc schematic it just says CS.
Posted: Wed May 20, 2015 5:20 am
Don't use the CS line of the PIC32 as it slows down the maximum SPI speed.
The SPI has to be dedicated to the picnc board alone.
Posted: Wed May 20, 2015 1:03 pm
Yes, I am using the CS line only for the PICnc part. The other chip is using the serial port. No chip select lines there. I just wanted to make sure I have the CS line connected to the correct spot on the Pi header to ensure your code will actually run correctly. The PICnc schematic only shows the CS line going to a small header. But of course it does not show how that header is wired to the Pi. If one is using wires and it does not work one can just try connecting it to another location. I have a trace running on the PCB, so it has to be right...
Posted: Wed May 20, 2015 1:16 pm
The current PICnc code does not use the CS line either. He just clocks the data on the fly and issues resets if things get out of sync. I hooked the CE0 line up on my laser cutter boards just in case but currently it is unused.
Posted: Wed May 20, 2015 5:51 pm
OK got it. I hadn't studied the code, so I didn't know that part. I'll keep the line connected then 'just in case' to stay compatible for potential future code updates. Obviously it does no harm to keep that line connected.
BTW, do you happen to know what document types can be posted on this forum? I tried to post a PDF of the board but it would not take PDFs.
Posted: Wed May 20, 2015 7:28 pm
I think just image files. Tried that before as well and ended up just linking to my website.
Posted: Fri Jun 05, 2015 10:07 pm
I only got hold of dupoint cables and need to know where the #1 and2 pin are.(and maby more)
Do i need to change anything before programing the pic?
MOSI (19) <----------------> (5)
RPI | PICnc
MISO (21) <----------------> (7) P3
SCLK (23) <----------------> (1)
GND (25) <--+-------------> (4)
Posted: Sat Jun 06, 2015 7:18 am
Here's the SPI pinout:
Posted: Sat Jun 06, 2015 2:23 pm
And i only need pin 1,4,5,7 for programing and running, right?
Or does 2,6,8 need 5v+ also?
Posted: Sat Jun 06, 2015 3:51 pm
I think those are ground as well for signal shielding. All the IOs on that connector are 3.3V so would not be 5V.
Been a long time since I looked at the logics from that board so may have that wrong but someone will pipe in and correct me if I have it wrong
Posted: Sat Jun 06, 2015 3:53 pm
The spi pins are only for normal operations.Programming is through JTAG or ICSP pins.
Pins 2,6,8 of the spi connector are and pins.
Posted: Sat Jun 06, 2015 4:17 pm
"Pins 2,6,8 of the spi connector are and pins"
So they are not in use and dont need 3,3v+?
Posted: Sun Jun 07, 2015 9:07 am
There's no V+ on the SPI pins. Power is supplied on the 5v port.
The 3.3v on the label means that the SPI signals are at 3.3v levels.
Posted: Wed Jun 17, 2015 9:51 pm
With Kinsa practically holding me by the hand each step of the way, I finally got my machine to work with LinuxCNC using his PICnc v2.1 board. However, I have been having some electrical noise issues...
I have a CNC mill setup that I had been using to make PCBs using some single-sided copper-clad. Beforehand, I was using the GPIO pins and a python script to read and interpret a gcode file and drive the motors with H-bridges. Since there was no 2-way communication (using GPIOs only as outputs), there was never any problem, but now, I am getting following errors like crazy.
I would like to know if anyone using their RPi with Kinsa's PICnc board for a 3-axis CNC mill has encountered these problems.
Specifically, I get following errors and have to restart MachineKit when I turn my spindle on or off (the wind-up and wind-down actions are what kill it). If I start the spindle, and then start up MachineKit, then I'm OK until I turn the spindle off.
Also, the instant the cutting bit on my dremel touches the copper-clad, I lose coms and get following errors on multiple axes. This is making it impossible for me to continue.
I would like to think I'm not the only one with these issues, but I thought I'd ask.
Posted: Wed Jun 17, 2015 11:54 pm
One idea to track where the noise comes in to the system:
- disconnect all the i/o cables from picnc to your mill. Basically isolate your mill from RPi + picnc.
- run an NC file and then start and stop your spindle. See if that trips machinekit.
- start adding back the cables and repeat the tests.
This will give you an idea where the noise comes in to the system.
BTW, you haven't reported the status of the signal picnc.spi_fault when the error occurs.
Posted: Thu Jun 18, 2015 12:18 am
How did you build machinekit on the RPI2?
Did you use a particular branch or install option?