TeensyCNC icon indicating copy to clipboard operation
TeensyCNC copied to clipboard

Teensy 3.1/3.2 unavailable - port to 4.0

Open ChromeFoundry opened this issue 2 years ago • 27 comments

Now that everyone is price gouging the old Teensy 3.2 for over $120 USD... is there any chance of porting this code to the Teensy 4.0? Your awesome hack is the only solution I've found for filling up landfills with obsolete Cricut Minis.

ChromeFoundry avatar Jun 29 '23 03:06 ChromeFoundry

Funny you should open this issue... I was actually just on the PJRC site looking at a 4.0. I needed to use my own mini and discovered that the USB port fell off the 3.2 I was using and had to do some repairs, thankfully I had a few 3.2's kicking around.

I don't think it would be too big of a job to do this, I just need a 4.0 and some time.

seishuku avatar Jun 29 '23 10:06 seishuku

I am more than happy to offer my assistance in porting this over to the 4.x. I haven't written code in C in a lot of years, so this would be a fun project to jump into. The Teensy platform is new territory for me as well, but I believe this is effort is very worth the time. Thanks for the work you have done on this to date...Bravo.

ChromeFoundry avatar Jun 29 '23 11:06 ChromeFoundry

In hindsight, I probably should have just done this whole project in the Arduino ecosystem instead of bare metal, it would have made porting easier... Oh well. Actually, what I really should have done was look into just reprogramming the original PIC MCU, it shouldn't have been that hard to do (there are already ICP headers on the main board), but I personally don't care for PICs and don't have any tools for them.

But yeah, feel free to try porting it yourself.

If I have some free time this weekend, I'll take a look at the SDK for the 4.x's MCU and see about tossing something together that could be used for testing maybe?

seishuku avatar Jun 29 '23 14:06 seishuku

Do you see any reason that recompiling for Teensy LC would not work? It appears they are pin compatible with the 3.1/3.2. I have not looked closes enough at your clocking and handling of the buffers to determine if this is option for least resistance.

ChromeFoundry avatar Jun 30 '23 04:06 ChromeFoundry

I do drive the PID loop for the motor control at a pretty high rate, but it's possible the LC can do it... Though with the USB serial interface and everything else, I have a feeling the 8K of RAM it has will disappear fast.

It wouldn't be a simple recompile though, while all the small form Teensy share similar pinouts, the MCU hardware registers are all different... So the GPIO ports/pin would have to be remapped and the hardware PWM/timers would need to be reconfigured to match the MCU it's running on.

seishuku avatar Jun 30 '23 05:06 seishuku

I'm getting the impression that this is quickly getting far outside of my league of expertise. I have a Teensy 4.0 and a Teensy LC being delivered soon. I am more than happy to test any code changes you are able to support either of these devices. It looks like the LC will soon become unavailable as well, so the 4.x is probably a better target if you choose to continue supporting this effort. The more I learn about the effort you put into this, the more I am in awe of your knowledge.

ChromeFoundry avatar Jun 30 '23 17:06 ChromeFoundry

Yea, I was wondering that about the LC... I'm guessing it's probably the Freescale Kinetis MCUs that they used on those boards that are being discontinued, so it gets harder to find them. Plus the whole MCU price gouging in general.

I did start a new branch for the Teensy 4, got a little bit kind of stubbed in... I guess I should probably get a Teensy 4 my self, it won't be long before I'll need to test on actual hardware.

Looking at the SDK, it seems to be fairly similar to the old Kinetis K20 MCU that the Teensy 3.2 used, but the general GPIO grouping and pin mux control is a bit weird, so I'll have to figure that out.

seishuku avatar Jun 30 '23 19:06 seishuku

Hello everyone!

Are there any updates regarding porting to 4.0? I would like to revive my old Cricut Mini and it seems teensy 3.2 is nowhere to be found anymore.

I will try to use a RP2040 to replace the Teensy 3.2 Do you think there are any incompatibilities? (not enough ram/flash, etc).

Best regards

tgsavs69 avatar Feb 24 '24 18:02 tgsavs69

I haven't had time to work on it any more than what's in the 4.0 branch, unfortunately. RP2040 should be more than enough though, might even be nice to move the PID and motor control onto the second core and leave the main core for input processing.

seishuku avatar Feb 27 '24 00:02 seishuku

It would be nice if an ESP32 or STM32 version was built. giving people options. the mini may be totally discontinued but, The mats and blades are standard between many versions of the cricut devices and still available. Ebay and like locations are loaded with cricut mini's. Given a more common platform GRBL esp32/stm32 I could see people developing a more dedicated gcode sender like lasergrbl only for cricut cutters. I would love to hack the one I was given but, do to the lack of teensy 3.2 and the 4.x version being still in development I'm rather stuck. Hardware modding is no challenge for me. Coding on the other hand is alien to me. I could see a small market for a limited kickstarter in creating a simplified mod kits to un-brick these (what should be wonderful devices).

berin-aquaquad avatar Dec 08 '24 01:12 berin-aquaquad

Honestly, I would prefer an STM32 device, I have decent experience with them and I really like the SDK. Does anyone have any suggestions for a Teensy footprint STM32 dev board? (besides the ancient blue/black pill)

Kinda fails the original project name, but moving forward it kinda just needs to work and I haven't been terribly happy with the MXRT SDK for the Teensy 4. That, or attempt to port the code to Arduino and let it live in that ecosystem. 🤷‍♀️

seishuku avatar Dec 08 '24 19:12 seishuku

Porting to arduino I dont see being worth while any version. One would have to use the existing second pic chip that does the quadrature work and alter the existing code. I'm not saying its not worth while but I could just see it being a steep hill to climb. stm32 esp32 is less important, but rather what one has the best long term support. And hardware level support for 2 quadrature encoders is really the most important aspect of the entire concept. The only aspect of this entire device that adds any level of difficulty regarding moding it is simply the fact that it has BRUSHED dc closed loop servos. If it had steppers modifying it would be a wave of the hand using off the shelf hardware and just removing the original control board all together. An other option if people wanted to be a bit adventures would be to use something like the pololu DRV8838 or DRV8801 and the pic servo control project that uses an attiny85 to drive a brushed servo controller using a quadrature encoder. or a single "stepper" pololu driver as a "2x" dc driver and 2 of the pic attiny85's one per motor. But again that would be assuming gutting the original controller totally. All in all I believe esp32 would be the better choice considering it has a stronger and growing community behind it. It would be fun to use one of the 32bit controllers and integrate the memory card adapter. and create a custom memory card to support say SD cards.

berin-aquaquad avatar Dec 08 '24 19:12 berin-aquaquad

That's fair about the esp32, you could also optionally leverage Bluetooth/Wi-Fi. ESP32-C3 Mini boards are pretty cheap, I'll see about ordering some... And try to find some time to do some actual work on this.

seishuku avatar Dec 08 '24 22:12 seishuku

If you would like any aid in hardware design. PCB, 3d design etc... let me know. Just some examples. My current project (not pictured YET) is building a WET jig able "box" for my large cnc machine. This will enable me to mill with aggression or at all materials that require flood cooling. https://photos.app.goo.gl/ZVxFnvZABBCnJGsW9 https://photos.app.goo.gl/ggAPhV6uwbvr4jLs8 ESP32 and BT/WIFI I could see the tablet crowd cheering, not to mention web interface features.

berin-aquaquad avatar Dec 09 '24 00:12 berin-aquaquad

Very nice!

The big goal back when I first started this was some kind of PCB that could be soldered into place of the original MCUs, much like mod boards for consoles.

seishuku avatar Dec 09 '24 01:12 seishuku

seishuku I sent you an email

berin-aquaquad avatar Dec 10 '24 00:12 berin-aquaquad

Ok, so I finally got an ESP32C3 board, took forever... Thanks Amazon. 🙄 After playing around with that for a bit, I don't think that's going to work. Apparently they can't do "classic" Bluetooth, only BLE... So to get a serial connection for sending G-code means a custom client app instead of something generic that can send to a serial port. I don't really want that, unless someone else wants to handle integration on a client app... I tried to do a quick and dirty one on Windows, it's a total mess. I'm sure on more civilized operating systems it wouldn't be that bad, but a generic serial port would be better IMO.

So... Maybe just a plain old ESP32 would be better for now (I have a few kicking around already).

Suggestions?

seishuku avatar Dec 19 '24 23:12 seishuku

Bt isn't the end of the world. Regardless I would imagine most people who are using these drag knife cricket machines are expecting to use a pc for the file setup Regardless.

Below is a link showing a working setup with links to the code and everything. It's also got built in wifi web controller. Runs on grbl.

https://embeddedtronicsblog.wordpress.com/2018/12/10/esp32-grbl/

Check that out. Also there's an auto compile website for a handful of different versions, I'll have to find the link.

I'm using this on my cnc machine currently. https://embeddedtronicsblog.wordpress.com/2023/05/17/grbl-running-on-the-4-axis-bsmce04-pp/

My forum post https://www.cnczone.com/forums/controller-cards/419158-cnc-posts-2.html

On Thu, Dec 19, 2024, 6:20 PM Matt Williams @.***> wrote:

Ok, so I finally got an ESP32C3 board, took forever... Thanks Amazon. 🙄 After playing around with that for a bit, I don't think that's going to work. Apparently they can't do "classic" Bluetooth, only BLE... So to get a serial connection for sending G-code means a custom client app instead of something generic that can send to a serial port. I don't really want that, unless someone else wants to handle integration on a client app... I tried to do a quick and dirty one on Windows, it's a total mess. I'm sure on more civilized operating systems it wouldn't be that bad, but a generic serial port would be better IMO.

So... Maybe just a plain old ESP32 would be better for now (I have a few kicking around already).

Suggestions?

— Reply to this email directly, view it on GitHub https://github.com/seishuku/TeensyCNC/issues/4#issuecomment-2555942443, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADWZMUFPYWNZKTWYO2KQHXT2GNIFRAVCNFSM6AAAAABTGXB4V6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJVHE2DENBUGM . You are receiving this because you commented.Message ID: @.***>

berin-aquaquad avatar Dec 22 '24 15:12 berin-aquaquad

I'm trying to find a certain link that deals with the esp32. will be worth it WHEN I find the stupid link.

On Sun, Dec 22, 2024 at 10:26 AM Berin @.***> wrote:

Bt isn't the end of the world. Regardless I would imagine most people who are using these drag knife cricket machines are expecting to use a pc for the file setup Regardless.

Below is a link showing a working setup with links to the code and everything. It's also got built in wifi web controller. Runs on grbl.

https://embeddedtronicsblog.wordpress.com/2018/12/10/esp32-grbl/

Check that out. Also there's an auto compile website for a handful of different versions, I'll have to find the link.

I'm using this on my cnc machine currently.

https://embeddedtronicsblog.wordpress.com/2023/05/17/grbl-running-on-the-4-axis-bsmce04-pp/

My forum post https://www.cnczone.com/forums/controller-cards/419158-cnc-posts-2.html

On Thu, Dec 19, 2024, 6:20 PM Matt Williams @.***> wrote:

Ok, so I finally got an ESP32C3 board, took forever... Thanks Amazon. 🙄 After playing around with that for a bit, I don't think that's going to work. Apparently they can't do "classic" Bluetooth, only BLE... So to get a serial connection for sending G-code means a custom client app instead of something generic that can send to a serial port. I don't really want that, unless someone else wants to handle integration on a client app... I tried to do a quick and dirty one on Windows, it's a total mess. I'm sure on more civilized operating systems it wouldn't be that bad, but a generic serial port would be better IMO.

So... Maybe just a plain old ESP32 would be better for now (I have a few kicking around already).

Suggestions?

— Reply to this email directly, view it on GitHub https://github.com/seishuku/TeensyCNC/issues/4#issuecomment-2555942443, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADWZMUFPYWNZKTWYO2KQHXT2GNIFRAVCNFSM6AAAAABTGXB4V6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJVHE2DENBUGM . You are receiving this because you commented.Message ID: @.***>

berin-aquaquad avatar Dec 23 '24 01:12 berin-aquaquad

https://www.youtube.com/watch?v=LbSBzOjWUxs have to chrome translate to english unless you speak russian but it has links to dealing with he wemos esp32board

On Sun, Dec 22, 2024 at 8:43 PM Berin @.***> wrote:

I'm trying to find a certain link that deals with the esp32. will be worth it WHEN I find the stupid link.

On Sun, Dec 22, 2024 at 10:26 AM Berin @.***> wrote:

Bt isn't the end of the world. Regardless I would imagine most people who are using these drag knife cricket machines are expecting to use a pc for the file setup Regardless.

Below is a link showing a working setup with links to the code and everything. It's also got built in wifi web controller. Runs on grbl.

https://embeddedtronicsblog.wordpress.com/2018/12/10/esp32-grbl/

Check that out. Also there's an auto compile website for a handful of different versions, I'll have to find the link.

I'm using this on my cnc machine currently.

https://embeddedtronicsblog.wordpress.com/2023/05/17/grbl-running-on-the-4-axis-bsmce04-pp/

My forum post https://www.cnczone.com/forums/controller-cards/419158-cnc-posts-2.html

On Thu, Dec 19, 2024, 6:20 PM Matt Williams @.***> wrote:

Ok, so I finally got an ESP32C3 board, took forever... Thanks Amazon. 🙄 After playing around with that for a bit, I don't think that's going to work. Apparently they can't do "classic" Bluetooth, only BLE... So to get a serial connection for sending G-code means a custom client app instead of something generic that can send to a serial port. I don't really want that, unless someone else wants to handle integration on a client app... I tried to do a quick and dirty one on Windows, it's a total mess. I'm sure on more civilized operating systems it wouldn't be that bad, but a generic serial port would be better IMO.

So... Maybe just a plain old ESP32 would be better for now (I have a few kicking around already).

Suggestions?

— Reply to this email directly, view it on GitHub https://github.com/seishuku/TeensyCNC/issues/4#issuecomment-2555942443, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADWZMUFPYWNZKTWYO2KQHXT2GNIFRAVCNFSM6AAAAABTGXB4V6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJVHE2DENBUGM . You are receiving this because you commented.Message ID: @.***>

berin-aquaquad avatar Dec 23 '24 02:12 berin-aquaquad

Had some time tonight to work on an ESP32 branch... Got the PWM outputs set up (currently all it does right now, just runs PWM tests on LEDs), most of the motor control stuff knocked out. Need to finish setting up encoder interrupts and test them. Then work on the main program, getting everything integrated back in (input handling, g-code interpreter, etc).

Edit: Probably doesn't matter, but I'm using a knockoff Lolin32 Lite, and also building using Espressif IDF environment.

seishuku avatar Dec 24 '24 05:12 seishuku

Got some life out of it at least: https://www.youtube.com/watch?v=ZA7o2VM0Ypo

seishuku avatar Dec 24 '24 20:12 seishuku

I solved what I was looking for before. https://github.com/bdring/FluidNC/releases there are MAP files regardless for the different board versions. I personally believe fluidNC would be the most mature base build regarding the use of ESP32. And it has a very mature implementation of wifi and BT.

On Tue, Dec 24, 2024 at 3:20 PM Matt Williams @.***> wrote:

Got some life out of it at least: https://www.youtube.com/watch?v=ZA7o2VM0Ypo

— Reply to this email directly, view it on GitHub https://github.com/seishuku/TeensyCNC/issues/4#issuecomment-2561382642, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADWZMUC6J4OYERQIAMSNZIT2HG6XBAVCNFSM6AAAAABTGXB4V6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRRGM4DENRUGI . You are receiving this because you commented.Message ID: @.***>

berin-aquaquad avatar Dec 26 '24 00:12 berin-aquaquad

nice work

On Wed, Dec 25, 2024 at 7:22 PM Berin @.***> wrote:

I solved what I was looking for before. https://github.com/bdring/FluidNC/releases there are MAP files regardless for the different board versions. I personally believe fluidNC would be the most mature base build regarding the use of ESP32. And it has a very mature implementation of wifi and BT.

On Tue, Dec 24, 2024 at 3:20 PM Matt Williams @.***> wrote:

Got some life out of it at least: https://www.youtube.com/watch?v=ZA7o2VM0Ypo

— Reply to this email directly, view it on GitHub https://github.com/seishuku/TeensyCNC/issues/4#issuecomment-2561382642, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADWZMUC6J4OYERQIAMSNZIT2HG6XBAVCNFSM6AAAAABTGXB4V6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRRGM4DENRUGI . You are receiving this because you commented.Message ID: @.***>

berin-aquaquad avatar Dec 26 '24 00:12 berin-aquaquad

sorry I've been silent for some time. Had to deal with the last of leaving my fathers house. he made everything hard with intent. Now I'm in a hotel with my daughter still waiting for money to be released from probate so I can buy a house. Just wondering how your doing and any progress? I've had a number of things happen good/bad very ugly. but when I am able to buy a house and setup evertying thingg I'm going to be even stronger then I was before by a LOT.

On Wed, Dec 25, 2024 at 7:26 PM Berin @.***> wrote:

nice work

On Wed, Dec 25, 2024 at 7:22 PM Berin @.***> wrote:

I solved what I was looking for before. https://github.com/bdring/FluidNC/releases there are MAP files regardless for the different board versions. I personally believe fluidNC would be the most mature base build regarding the use of ESP32. And it has a very mature implementation of wifi and BT.

On Tue, Dec 24, 2024 at 3:20 PM Matt Williams @.***> wrote:

Got some life out of it at least: https://www.youtube.com/watch?v=ZA7o2VM0Ypo

— Reply to this email directly, view it on GitHub https://github.com/seishuku/TeensyCNC/issues/4#issuecomment-2561382642, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADWZMUC6J4OYERQIAMSNZIT2HG6XBAVCNFSM6AAAAABTGXB4V6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRRGM4DENRUGI . You are receiving this because you commented.Message ID: @.***>

berin-aquaquad avatar Apr 16 '25 23:04 berin-aquaquad

Sorry to hear that, hopefully all goes well for you!

I've been pretty busy with work and a few other projects, so I haven't had time to put towards this. My test setup kind of got buried on my desk, I probably should dig it out and make sure it's still in one piece. lol

seishuku avatar Apr 17 '25 11:04 seishuku