gnea / grbl-LPC

Other
74 stars 75 forks source link

grbl-lpc on LPC1768 at 100MHz #5

Open TomKeddie opened 7 years ago

TomKeddie commented 7 years ago

Hi Claudio,

I'm looking around for some hardware to retrofit into a laser cutter and use laserweb/grbl-lpc. I hope you have a moment to answer my question.

From looking at the grbl-lpc code it looks like it runs at 120MHz.

define XTAL (12000000UL) /* Oscillator

frequency */

This would imply an LPC1769 is needed and the LPC1768 is not fast enough (or code changes are needed for 100MHz).

I see mention on reddit that it works on some 1768 boards, should I adjust the above for 100MHz perhaps?

https://www.reddit.com/r/hobbycnc/comments/6b9p48/grbllpc/

Many thanks, Tom

cprezzi commented 7 years ago

I guess you are right, but I'm not the LPC specialist here. @tbfleming Can you step in with your deeper knowlede please.

tbfleming commented 7 years ago

I'll try to explain later when I have time. The quick answer is: no, it's complicated enough that you need to use one of Arm's wizards to edit the headers to change clock frequency.

cprezzi commented 7 years ago

At least I can say that grbl-LPC works on the MKS SBase board (LPC1768) without changes ;)

tbfleming commented 7 years ago

MKS used a '68? Lame! There's not much price difference between the two chips.

tbfleming commented 7 years ago

@cprezzi if you have a scope handy, I'd be curious to hear if the step rate is coming out correctly. I think I know what MKS might have done; if so the normal build would throw off the timers instead of overclocking the chip.

TomKeddie commented 7 years ago

As far as I know this is the mks sbase schematic, can't recall where I got it.

MKS SBASE SCH_V12.pdf

cprezzi commented 7 years ago

Thanks @TomKeddie! In this schematics, it is a 1769, but on my board (from aliexpress) it is a 1768 and grbl-LPC works with my board.

tbfleming commented 7 years ago

The schematic is missing a critical value: Y1's oscillator frequency. The ARM wizard needs to know this value to modify the header file to set the PLL config bits correctly. The PLL converts the input oscillator to the various clocks within the chip. The wizard figures out how to configure the PLL to do that correctly.

2 possibilities:

cprezzi commented 7 years ago

@tbfleming Y1 on my board is 12.000 MHz and Y2 is 25.000 MHz

tbfleming commented 7 years ago

@cprezzi that means we're currently overclocking your chip.

cprezzi commented 7 years ago

@tbfleming I didn't realize any problems yet, but I will check if the MCU gets hot.

TomKeddie commented 7 years ago

@cprezzi I'm not sure it's like that for small micros. The LPC1768 and LPC1769 are likely the same chip tested and sorted according to the testing. I think it's more likely the chip will misbehave if the external environment makes it hot.

Perhaps we should tag this issue as an enhancement and plan to generate an alternate 100MHz config that people can switch in the Makefile?