Repository navigation
Description
I'm getting the seventeen build errors listed below. Trying to build for a BTT SKR 1.4 Turbo with four TMC2130's. If I comment out the #define TRINAMIC_ENABLE 2130 in my_machine.h it builds just fine. This is from a current (Aug 5, 21) git recurse-submodules pull.
Description Resource Path Location Type c:/nxp/mcuxpressoide_11.4.0_6224/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(lib_a-closer.o): in function_close_r': GRBL Driver LPC176x C/C++ Problem
c:/nxp/mcuxpressoide_11.4.0_6224/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(lib_a-fstatr.o): in function _fstat_r': GRBL Driver LPC176x C/C++ Problem c:/nxp/mcuxpressoide_11.4.0_6224/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(lib_a-isattyr.o): in function _isatty_r': GRBL Driver LPC176x C/C++ Problem
c:/nxp/mcuxpressoide_11.4.0_6224/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(lib_a-lseekr.o): in function _lseek_r': GRBL Driver LPC176x C/C++ Problem c:/nxp/mcuxpressoide_11.4.0_6224/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(lib_a-readr.o): in function _read_r': GRBL Driver LPC176x C/C++ Problem
c:/nxp/mcuxpressoide_11.4.0_6224/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(lib_a-signalr.o): in function _getpid_r': GRBL Driver LPC176x C/C++ Problem c:/nxp/mcuxpressoide_11.4.0_6224/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(lib_a-signalr.o): in function _kill_r': GRBL Driver LPC176x C/C++ Problem
c:/nxp/mcuxpressoide_11.4.0_6224/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(lib_a-writer.o): in function _write_r': GRBL Driver LPC176x C/C++ Problem make: *** [makefile:40: Firmware.axf] Error 1 GRBL Driver LPC176x C/C++ Problem undefined reference to _close' GRBL Driver LPC176x line 0 C/C++ Problem
undefined reference to _fstat' GRBL Driver LPC176x line 0 C/C++ Problem undefined reference to _getpid' GRBL Driver LPC176x line 0 C/C++ Problem
undefined reference to _isatty' GRBL Driver LPC176x line 0 C/C++ Problem undefined reference to _kill' GRBL Driver LPC176x line 0 C/C++ Problem
undefined reference to _lseek' GRBL Driver LPC176x line 0 C/C++ Problem undefined reference to _read' GRBL Driver LPC176x line 0 C/C++ Problem
undefined reference to _write' GRBL Driver LPC176x line 0 C/C++ Problem


Activity
terjeio commentedon Aug 6, 2021
There is an incorrect library setting in release builds, should be like this:
I have a rather large overhaul of the Trinamic code in the pipeline, includes support for ganged motors and TMC2209 (UART mode). I need testers, can you help?
jimmejames commentedon Aug 6, 2021
Yes, I'd love to help- have the time and hardware. FWIW- it's a custom built foam cutter (using standard ball screws) with end stops for the minimums connected to a BTT SKR 1.4 Turbo with four TMC2130's.
Also- the library change above worked great. I was able to build using the BL_0x4000 and my board accepted the files enough for Grbl HotWire Mega 5X (v5.02) to 'see' it, but I could not get it to move. More info than you asked, but wanted to give you an idea of my setup.
terjeio commentedon Aug 6, 2021
Try
$4=7(inverts stepper enable) possibly in combination with$338=7(Trinamic driver enable).$338is not available in all configurations, will return an error if not. Do you have the fourth axis (A) enabled or ganged/auto-squared motors?Great, I will switch over to a SKR 1.4 board during the weekend (with TMC5160 drivers) and check the basic stuff. When that is done I will upload the complete project and come back with a link for download.
jimmejames commentedon Aug 7, 2021
I'm getting an error on my Grbl Hotwire:

So connecting to CNCJS running on a linux box and getting a different error:
`CNCjs 1.9.22 [Grbl]
Connected to /dev/ttyACM0 with a baud rate of 115200
,1024|FS:0,0|Pn:PXYZRHS>
Bear with me- I've used Marlin up until now, so Grbl is all new. Tried $4=7 && $338=7, but I think my error is upstream... currently working it.
terjeio commentedon Aug 7, 2021
Do you kow if the source available on github for this sender? Since it is based on Grbl Panel I believe I am able to patch it (I have patched Grbl Panel - but since it is archived I cannot create a PR).
grblHAL defaults to normally closed switches for safety reasons, try with
$14=7to invert the inputs. You migth also want to compile with compatibility level set > 0.ioSender can be used to configure the controller, its Settings: Grbl tab is easy to use and has support for all the new settings in grblHAL.
terjeio commentedon Aug 7, 2021
Updated LPC176x project and ioSender are now available for download here.
LPC176x project tested with TMC2130 and TMC5160 drivers, the basic stuff works. Trinamic driver related settings and M-codes documented here.
FYI ioSender has a Trinamic tuner tab that can be used to plot live Stallguard result (load) and query driver status (M122), this is work in progress...
jimmejames commentedon Aug 7, 2021
Cool- I pulled your files, created a new project in MCUXpresso, and only updated the number of axis in config.h, and then change to my SKR 1.4 and 2130's in my_machine.h and everything built great.
Starting with compatability_level 0 in config.h and it (effectively) works out of the box with ioSender! (sweet program btw!) I have something not quite right as 1) A/E0 doesn't spin (although it sounds like one of the motors is trying- I think maybe Z, but need to try again later today) and 2) my steps/mm aren't right as they done spin as far as they should (calibration issue I haven't looked at).

Right now, I have a 2130 populating X, Y, Z, and E0 (and motors are connected to the same). All are decoupled to individual Nema 17's. I run 24v power to the SKR and power the motors directly from the board- really just FYI as I'm not trying some very custom setup.
So far- this is awesome!
Edit- didn't answer your other question. The Grbl Hotwire is from here: https://rckeith.co.uk/file-downloads/ and the CNCJS is I think just an apt install from a Debian 10 (buster) terminal.
Edit 2: Played with it a little more and I see that nuts_bolts.h defines axis (such as the A_AXIS) as soon as N_AXIS > 3. This A axis is the only one that doesn't work and I've confirmed the points match what's in btt_skr_1.4.turbo_map.h to here: (https://github.com/bigtreetech/BIGTREETECH-SKR-V1.3/blob/master/BTT%20SKR%20V1.4/Hardware/SKR-V1.4-Turbo-pinout.jpg)
Here's the relevant part from my config.h:
What am I missing?
terjeio commentedon Aug 8, 2021
Have you set
$7and$338to15?Well, then I guess the source code is not available and I cannot make a PR.
jimmejames commentedon Aug 8, 2021
When I try to move A, the X motor physically feels and sounds like it's energizing.
Note, I currently have my min limit switch reversed from the others so I will see the board is communicating with it. I forget if it's NC or NO, but the red square should go out when it is seen (I'm basing this on the operation of the others).
Here's my settings.txt from ioSender:
terjeio commentedon Aug 8, 2021
It looks like enabling the A-axis driver fails...
Are all motors listed when you press "Get status, all drivers" in the Trinamic tab? And has the status register content for the A motor at the bottom of the list a sensible value if so?
Set
$37=15to keep motors energized at all times. IMO at least the Z motor should be kept energized, at least if the spindle tends to move down due to gravity pull when deenergized.Do the X-motor behave the same after?
If you have a voltmeter what is the voltage on the EN pin of the A driver? Should be 0.
I have checked the STEP, DIR and EN signals with a scope on the SKR 1.3 I have and they look ok, I will check with a fourth driver and a motor (if I can find one) later.
jimmejames commentedon Aug 8, 2021
Hello,
No, the Trinamic tab doesn't appear if I start the ioSender program with Trinamic driver enabled for A. So I go to the Settings: Grbl tab and uncheck A from the Stepper Driver dropdown, then close and restart the program.
On the next load, "Get status, all drivers" works great for X, Y, and Z:

I then enable A and "Get status, all drivers" doesn't return anything:

Probably unrelated, but I didn't move the steppers between screenshots and the X and A positions show different values.
terjeio commentedon Aug 8, 2021
Ok, then UART communication fails for the A-motor. If communication fails for one none are enabled. I'll look into this later - I have some outside work to take care of.
jimmejames commentedon Aug 8, 2021
Thank you! I'll experiment moving the 2130's and motor connections around to make sure there isn't something mechanically/electrically wrong.... trying to eliminate variables.
terjeio commentedon Aug 8, 2021
There is a typo here:
LPC176x/src/btt_skr_1.x.c
Line 166 in d60e133
should be:
cs_bit[A_AXIS] = TRINAMIC_CSA_BIT;Same in line 172.
Perhaps fixing this will solve it... I am busy for a while more - perhaps you can check before I get to do it?
jimmejames commentedon Aug 8, 2021
Much closer!

All steppers now report, but when trying to move A, X still tries to move and the limit switch (for A) isn't reporting correctly. My Z and A are setup identical (same 2130's and same steppers), so I swapped them to make sure it wasn't the hardware and same result. FWIW
I still get an "out of range" error with $7=15, but $338=15, and $37=15 work. $37=15 gives an audible motor-holding noise on just my Z axis.
Edit- held the wife & kids up from photos to test this- so I'll play with it some more tonight when we get back.
7 remaining items
terjeio commentedon Aug 9, 2021
It is the status register value, not a MAC address... The least significant 10 bits are the Stallguard sg_result.
Can you turn the A motor easily when EN is 0V? If you can then the motor is not energized as it should.
Maybe a bug is somehow setting the A driver to freewheeling? Strange it is working with the SKR v1.3 board I have...
Test by only enable the A motor ($338=8)?
Is VM (motor voltage) ok? (I guess it is since the A status register is non-zero).
Try inverting the A step output with
$2=8(or set it with Stepper > Step pulse invert in ioSender). The Step signal should go to 3.3V after you do that.jimmejames commentedon Aug 9, 2021
Measuring STP -> Gnd, I get the ~3V for the Z axis when I invert the set pulse, but ~0VDC on A with either it inverted or noninverted.
And yes, dead stick on A- no resistance.
terjeio commentedon Aug 9, 2021
Hmm, an error in the schematic? But it does not explain why the motor is not energized. Bad TMC2130? But it is working with Marlin?
jimmejames commentedon Aug 9, 2021
Haha- I just swapped only the TMC2130's on Z and A and nothing was moving... forgot I had $338=8. Putting $338=15, I have the same issue, Z moves (with the 2130 I just pulled from A). I'll flip back to the Marlin code before. I think I only was getting 3 axis to work, but attributed that to software that wasn't designed to do, so I started looked at grbl. Let me circle back to it and make sure I can get all four to move with Marlin.
Edit- Just confirmed, I have all four axis working with Marlin (X, Y, Z, and E0)- based on this code:
https://github.com/bigtreetech/BIGTREETECH-SKR-V1.3/tree/master/BTT%20SKR%20V1.4/Firmware/Marlin-2.0.x-SKR-V1.4-Turbo
Here are the files I changed:
Marlin.zip
Cncninja commentedon Sep 6, 2021
How can I add the 2209, the only options are 2130 and 5120 I swapped 2130 for 2209 as i see the 2209 hal is there but got a bunch of errors when it compiled .. thank you
Cncninja commentedon Sep 6, 2021
terjeio commentedon Sep 7, 2021
You have to add UART low-level driver code required. But does the board support UART mode Trinamic drivers? And if so is the UART pins connected to hardware UART capable MCU pins or must software UART code be implemented?
drom89 commentedon Oct 3, 2021
Hello, i have BTT SKR 1.4T with BTT TMC 2209. And cant get it working.
For your question UART is working no problem with Marlin.
But i dont know if its a hardware connection or software :(
The jumper setting is different from SPI mode: https://github.com/bigtreetech/BIGTREETECH-SKR-V1.3/blob/master/BTT%20SKR%20V1.4/BTT%20SKR%20V1.4%20Instruction%20Manual.pdf
BTW how do i add UART low-level driver code ?
terjeio commentedon Oct 3, 2021
It is both, IMO bad design choice by BTT that requires software UART code to be added.
One approach would be to implement similar code as used in Marlin, others could be searching the internet for ideas or come up with something from scratch. The easy part will be to send data as the TMC2209 is quite forgiving when it comes to the baud rate, a bit more tricky (I guess) would be to receive and decode data, at least one timer has to be used to time the bit transitions? And perhaps interrupts has to be disabled so that timing of the bit stream isn't disturbed too much?
Or maybe @fitch22 can help as it seems he has software serial working for BTT SKR-2 boards.
Here is an example how UART mode is implemented in a STM32F411 driver when a hardware UART is available and lowlevel UART driver code is available. It is the code inside
#if TRINAMIC_ENABLE == 2209 ... #endifblocks.terjeio commentedon Oct 3, 2021
@jimmejames Did you resolve the A-axis issue? As I do not get a notification when a comment is edited I have not noticed your addition before now.
drom89 commentedon Oct 3, 2021
I just found this in Marlin but this stuff is out of my programing league. So i will wait if @fitch22 can get something to work and as backup plan i will order new drivers with SPI.
https://github.com/MarlinFirmware/Marlin/blob/a185ce22cf6e4fb15250815c5c39318606a7e65a/Marlin/src/module/stepper/trinamic.cpp
jimmejames commentedon Oct 3, 2021
@terjeio Unfortunately, no. I changed to GRBL and got all four working with that.
fitch22 commentedon Oct 3, 2021
drom89 commentedon Oct 3, 2021
@fitch22
So can you upload the code somewhere ? I would like to try it.
I have SKR 1.4T not SKR-2 so it should be ok...
fitch22 commentedon Oct 3, 2021