Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIC32MX4 Modifications & MPLAB Project #4

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

n9wxu
Copy link

@n9wxu n9wxu commented Dec 18, 2015

Improved performance and ported to the MX440.
Temporarily removed the PWM feature.
Added additional inputs to support a derivative HW board.
Increased the step rate to 138khz. 80Mhz is starting to run out of steam at this point.
Getting ready to use the PIC32MX470 to increase the clock speed to 120MHz.


This change is Reviewable

Improved performance and ported to the MX4.
Previous update did not include the important changes.
@n9wxu
Copy link
Author

n9wxu commented Dec 18, 2015

Forgot to include the important changes to main & stepgen.

These files are a modification from the OSHPARK build.
OSHPARK revision needs MCLR & I2C pullup resistors.  I2C is optional for
now.
@n9wxu
Copy link
Author

n9wxu commented Dec 18, 2015

Hardware files for the V3 PI Hat.
V3 hardware is here https://oshpark.com/shared_projects/xTIz9hC0
The oshpark build is missing a MCLR pullup resistor.

PWM's now mapped to the step channels.
Enables are now mapped as the step channels
E1_Direction is now the master stepper driver enable.
X_STEP is still the step because X_ENABLE is defective.
OC2-4 are used for PWM OC1 is not used.
@n9wxu
Copy link
Author

n9wxu commented Dec 19, 2015

Some additional hardware issues on the V3 board at OSHPARK.
X1_ENABLE is not connected to the PIC32. X1_Step will remain unchanged. Other Enables will become step generators and the step generators will become PWM.

@adbensi
Copy link

adbensi commented Dec 19, 2015

very interesting, I'm changing the board for debugging and testing .. congradulations n9wxu!
top
bot

@n9wxu
Copy link
Author

n9wxu commented Dec 19, 2015

Good looking board. My only comment is it is generally a bad idea to put via's under pads. The reason is due to solder stencils. The via will absorb more solder than the pad will so you need a larger opening in the stencil to put more paste on those pads. It is better to move the via away from the pad so all stencil openings are a consistent size. Obviously if you do not plan on using stencils, this is not an issue.

@n9wxu
Copy link
Author

n9wxu commented Dec 19, 2015

img_1665
img_1666

Board on right has engineering sample MX470. That will run at 120Mhz.

refactored to go back to a single call to stepgen.
added a macro to make the step generation DRY.
reduced the step accumulator to 65536 (not really sure if this is a good
idea)
increased the core timer rate to 200khz (52% CPU for step generation on
4 Axis)
Made the appropriate changes to the HAL.
programmable stepwidth is still not supported.
@n9wxu
Copy link
Author

n9wxu commented Dec 20, 2015

Reached 200KHz. The stepper motor really moves!

I restored the original step algorithm sans stepwidth adjustment.  It is
still operating at 200khz.
@adbensi
Copy link

adbensi commented Dec 21, 2015

n9wxu, You are using SYS_FREQ = 80MHz and BASEFREQ = 150KHz with MX470 or MX440?
great job! I look forward to see these speeds 👍

@@ -50,11 +50,11 @@ typedef enum {
#define SPIBUFSIZE 20 /* SPI buffer size */
#define BUFSIZE (SPIBUFSIZE/4)

#define STEPBIT 22 /* bit location in DDS accum */
#define STEPBIT 16 /* bit location in DDS accum */
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are sacrificing step resolution over speed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The max speed step frequency is not limited by those settings. In any case I put your algorithm back. Stand by for another pull request.

Sent from my iPhone

On Dec 21, 2015, at 3:51 PM, GP Orcullo notifications@github.com wrote:

In HAL/picnc.h:

@@ -50,11 +50,11 @@ typedef enum {
#define SPIBUFSIZE 20 /* SPI buffer size */
#define BUFSIZE (SPIBUFSIZE/4)

-#define STEPBIT 22 /* bit location in DDS accum /
+#define STEPBIT 16 /
bit location in DDS accum */
You are sacrificing step resolution over speed


Reply to this email directly or view it on GitHub.

@n9wxu
Copy link
Author

n9wxu commented Dec 22, 2015

I push more code up tonight because it is at 200khz now.

Sent from my iPhone

On Dec 21, 2015, at 3:43 PM, adbensi notifications@github.com wrote:

n9wxu, You are using SYS_FREQ = 80MHz and BASEFREQ = 150KHz with MX470 or MX440?
great job! I look forward to see these speeds


Reply to this email directly or view it on GitHub.

@n9wxu
Copy link
Author

n9wxu commented Dec 22, 2015

This restores the higher resolution steps and keeps the 200khz step rate.

@n9wxu n9wxu closed this Dec 22, 2015
@n9wxu n9wxu reopened this Dec 22, 2015
attempted to speed up the ISR by generating the step pattern in a FIFO
It can't produce more than 1 step ahead reliably so the ISR runs dry
when operating with a FIFO.
@adbensi
Copy link

adbensi commented Jan 23, 2016

n9wxu, if You have odroid C1, there is last RT kernel
https://github.com/adbensi/kernel-odroidc-3.10.80-rt102
Best Regards

@adbensi
Copy link

adbensi commented Apr 3, 2016

20160402_140117
Odroid C0 ready :D

@kinsamanka
Copy link
Owner

The Orange Pi One is a cheaper alternative ;-)
On Apr 4, 2016 6:08 AM, "adbensi" notifications@github.com wrote:

[image: 20160402_140117]
https://cloud.githubusercontent.com/assets/8729496/14235538/badadfb8-f9d7-11e5-9f3d-6e4644746a2a.jpg
Odroid C0 ready :D


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#4 (comment)

@creisey
Copy link

creisey commented Mar 7, 2020

how is the state at that project? im looking forwards for this

@n9wxu
Copy link
Author

n9wxu commented Mar 7, 2020 via email

@creisey
Copy link

creisey commented Mar 10, 2020

20160402_140117
Odroid C0 ready :D

i have some trouble with getting the odroid c0 running with linuxcnc... how did you proceed? all the tutorials i found are more than 2 year old and seam not woring anymore
with the prebuilt machinkit image from https://0ptr.link i have trouble with SPI and network

cheers

@adbensi
Copy link

adbensi commented Mar 10, 2020 via email

@creisey
Copy link

creisey commented Mar 10, 2020

i tried that, but i had problems during the make process.

image
it seemed related to gcc version 7

could you provide a compiled kernel to me?
and what bases did you use? the Ubuntu MATE 18.04.3 image form hardkernel?

@adbensi
Copy link

adbensi commented Mar 10, 2020 via email

@creisey
Copy link

creisey commented Mar 21, 2020

i tried that, but i still cant compile, there are issues with gcc7, do you have the Odroid c0 running with Picnic?

is there a chance to buy a picnic hat? tindie option? ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants