-
Notifications
You must be signed in to change notification settings - Fork 27
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
GrblHAL support for BTT SKR MINI E3 V2.0 3D printer board #2
Comments
It should work out of the box? You will have to create a map file for it as I assume none of the current mappings will work. |
Hi terjeio |
There is no need for a new project build folder, post the pin map file here and I will incorporate it in the current one. Alternatively create a PR for it. |
I have created the CPU pin map, the file is here as attachment, additional note: |
UART mode for TMC2209 is not possible to test for me as I do not have hardware for that. With lots of luck in might work... SDCAR and EEPROM support should be possible to add as well, but needs code changes as pins & ports are not the same as the ones already supported? How is this board programmed, via a bootloader or a ST-link programmer? If via a bootloader it is likely changes will have to be made (new linker script). |
via bootloader; you put the bin file inside the SD card and when you reboot the board, the code loads. Can we upload the GRBL based compiled bin file/code to the card with the same method? |
Yes, but kind of hard for me to make a working binary when I am not able to test it. And there is a risk of bricking the card, the only way to recover it if this happens is to use a ST-Link programmer. Do you have one? |
Yes I have ST-Link programmer, no problem I can repair the bootloader, by the way I compiled the code you edited and uploaded it to the board, I can communicate and move the motors but I couldn't communicate and set the tmc2209 |
Great, having the programmer means you can set breakpoints for debugging. Do you have access to an oscilloscope or logic analyzer? First step would be to check if there is any traffic on the Trinamic driver UART, set breakpoints here Line 427 in 643400d
and here Line 440 in 643400d
Are they hit? |
Yes, I have both the oscilloscope and the logic probe. Other thing, is there any gcode to check the status of tmc2209 via using console? |
Great, that will help if we run into problems with the UART code. I have done some testing today with a Bluepill. There are a couple of bugs - init code for the TMC2209 was not in place and there were some timing issues in the low-level interface code. I'll commit an update tomorrow. Using flash for settings storage might require some work, the memory map is different and that could be the reason it hangs. I'll come back with how to disable this. It is likely to be easier to later switch to EEPROM storage than attempt to fix flash storage, I prefer EEPROM storage when available so I guess that should be prioritized.
Yes, a number of Marlin style M-codes are implemented - M122 is for debugging. Info here. FYI ioSender has a tab for Trinamic driver tuning that uses the debug information. Example M122 output:
Note that you have to enable Trinamic drivers with the $338 setting! |
Update just committed. I have enabled EEPROM support - this causes flash overflow so I had to add a new linker script to take advantage of the larger flash (and RAM). You have to select the Debug F103RC build option available in the build menu (from the "hammer" icon) to make it compile. |
You are a responsible and very helpful person, thank you very much.
I re-uploaded the code you just edited, but nothing changed, it still hangs in the same place during debug, I took a video and added it below
in ioSender, after connet the bord the console output |
Have you enabled the BTT board in my_machine.h? This line has to be commented in: Line 26 in ad3d08b
|
Yes this is my file // NOTE: Only one board may be enabled! // Configuration #define USB_SERIAL_CDC 1 // Serial communication via native USB. Comment out for UART communication. |
when I followed the debugging step by step, I found that it was hangs at this point, I think it hangs because it is waiting for data on the usb, is it correct? Line 80 in ad3d08b
|
When the USB output buffer is full it loops there until a connection is established. I have updated the ST driver framework to the latest version and I am having problems with flakiness - perhaps due to the MCU beeing a clone or the fact that I have nearly used all available flash/RAM: I have found a couple of further bugs, and I am reminded why did not add TMC2209 to the initialization - the code is not 100% ready... If you are still interested there are a few more things to try: Add Change this line Line 448 in ad3d08b
to USART->BRR = UART_BRR_SAMPLING16(HAL_RCC_GetPCLK1Freq(), 115200); to get the correct baud rate. I am not sure this line is needed or not, comment out if UART output is not working: Line 445 in ad3d08b
Disable settings storage by changing Line 905 in ad3d08b
to #elif xFLASH_ENABLE as it seems the I2C EEPROM is not recognized. I have it working with my Bluepill so I am not sure why. Can you check the label on the EEPROM chip and verify that it is an AT24C32? Set breakpoints at line 39, 61 and 63 here: STM32F1xx/Src/btt_skr_mini_e3_2.0.c Lines 39 to 63 in ad3d08b
When continuing from line 39 you should see output on the UART line, if a valid response is forthcoming the next break should be at line 61 - if not it will stop at line 63. Here is a valid read transaction on my scope, timebase is 200us/div: The blue and yellow traces track each other when transmitting, the blue trace shows the response. This since Rx an Tx is wired together via 1K resistor and I am monitoring on both ends of it. Finally - I can upload the project as it is now as a zip file if of interest. |
Yes please, I want to run this board with grblHal. I am quite interested it |
What's your suggestion about it not accepting the M122 command? |
Ok, you can download it from here.
It is due to no motors accepting/responding to configuration during startup. |
BT24C32A |
STM32F1xx/Inc/btt_skr_mini_e3_2.0_map.h Line 37 in ad3d08b
Change 2 to 3 in this line - I forgot about the 4K chips having a 32 byte page size. I believe it is the first time I've encountered one, hopefully EEPROM storage will then work (you will have to undo the FLASH_ENABLE hack above to test). |
EEPROM is OK, stored the my setting still tmc2209 is not working :( |
Are the breakpoints mentioned above above getting hit? If so, any activity on the UART line? |
I will remove the card from its slot and monitor the uart activities with the analyzer as soon as possible. |
I have assembled a revised Nucleo-64 CNC breakout board (for a F446) and managed to get multiple TMC2209 drivers working by increasing the post read data delay to 5000 (from 150): STM32F1xx/Src/btt_skr_mini_e3_2.0.c Line 65 in ad3d08b
Note that the current code does not support sensorless homing as the Stallguard implementation is different from TMC2130/5160 version. I am looking into that now. |
Sorry for delayed reply |
Oops, I forgot about that. Add It compiles for me when I do that. |
Ok, it didn't give a compile error after making the following changes I modified the following files for path I changed both #include "ffi.h" and #include "diskio.h" |
You fooled me with your map file? This text is just before the pin definitions:
Have modified stm32f1xx_hal_msp.c to match the definitions? |
I made the changes but the SD card error did not change. I monitored the SPI pins with an oscilloscope no activity void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi) /* USER CODE END SPI1_MspInit 0 / #ifdef BTT_SKR_MINI_E3_V20 #else
#endif /* USER CODE BEGIN SPI1_MspInit 1 */ /* USER CODE END SPI1_MspInit 1 */ } |
... has to be removed. I have uploaded a new version that sets a symbol for backwards compatibility. And I had to reduce the SPI clock frequency to make it work, this is likely due my test setup with a breadboard and flying leads. You should try to increase it again by reducing the clock divider: Line 203 in ad3d08b
|
Excellent, thank you so much |
Great, I tried with the board for the first time, the result is successful, now we are used as a CNC machine with a 3D board, |
terjeio |
It will be the same (or similar) as for the LPC176x driver? A new build option and a corresponding linker file or linker scripts. |
Hey nice work getting this up and running. I'd like to test this out on a two axis machine. Is there a way to build this project on Linux, without Eclipse? I tried to follow https://github.com/grblHAL/core/wiki/Compiling-GrblHAL for compiling with Arduino (on macOS) but I realized the board wasn't supported by the built-in board manager. The following attempt failed because the default target
|
Possibly, I have not investigated other options such as PlatformIO or use of command line make.
The CMakeLists.txt in the grbl folder is only for the core and is intended for builds of drivers that uses cmake, such as the RP2040. |
I checked the CPU linker related parts you mentioned, but I couldn't get over it, it was a bit confusing. |
Hi, was sensorless homing ever implemented? I've seen no other mention of it on this thread and I can't get it to work on my machine. I've tried the same board with Klipper and it works perfectly with that software and the same hardware so I'm assuming there's something wrong with the TMC2209 implenentation on grblHAL. |
I believe it is, but not sure about the parameters - I do not have a machine to test with.
Could well be, but most likely issues with the parameters (tuning) and not the code? Do you know the parameters that Klippers use and can compare them with grblHAL? |
I'm not sure whatever to post this here or open a new issue, if you believe this deserves to be it's own issue please tell me all I'll open one accordingly. Here's the output of
If I manually unlock the machine then I'm free to move any axis without any problem, but when they are being moved as part of the homing process, here's what happens: https://streamable.com/ikk2mo First movement is homing, second movement is a G0 command after manual unlock. I've also tried to home without sensorless activated and every axis moves correctly, this problem is caused by having sensorless homing activated) In the past (a month ago) I used this board with klipper with the following settings and sensorless homing worked without a problem. I'd like to point out that the only code change that I've performed in grblHAL has been swapping the values of I'd also like to ask: I've been looking though the code to quickly see what each settings does, as a lot of them do not show a description with |
@lluiscab There is something odd with the Z-axis sg_result, it is way higher than the other axes.This might be the reason for the noisy movement. A heavy spindle? What happens if you try without the spindle mounted?
I guess ganged motor support should be added to this driver, this would allow you to use the E motor driver for the second Y-motor. Having two motors on the same driver is not ideal. Are you using Windows and can try ioSender? - it has a Trinamic tuner tab where you can visualize the StallGuard result for different values of the Stallguard threshold.
The descriptions must have been added by your sender - they are not coming from the controller like that. The missing descriptions are thus due to the sender not knowing about the new grblHAL settings. Use |
Those values were captured after a failed homing attempt. Here's the output of
I currently do not have a spindle mounted onto the Z axis. Ganged motors using the E driver would be a nice to have. I am using Linux, it seems like ioSender is only available for Windows, I guess I could try a VM or move the machine closer to a windows PC. What should I do there? Change the threshold values until it works? |
It is those values that are somewhat useful for tuning. The ioSender tuning tab is better, but for ideal tuning you will need an oscilloscope with a current probe (IIRC) - see the driver datasheet.
Basically yes, you cannort expect the default values to work. I have updated the plugin readme with some missing settings and links to driver information, the datasheets have fairly comprehensive information on how to tune StallGuard. |
Okay, been playing with ioSender for about an hour now, I've tried every possible value for stall guard and it does not work. I've reflashed the board with klipper and homing there worked perfectly without any weird motor noises or anything like that. It does seem to me like nothing changes between runs, I'm pretty sure that whatever or not the motor makes noise has nothing to do on what the threshold value is, as said, with klipper is runs perfectly without a problem. There 100% has to be something wrong during the homing sequence, if I unlock the machine manually, I can then jog each axis manually and the motor moves perfectly. Pretty sure there's something that's not correctly implemented somewhere |
Update: While monitoring the stall guard value live (M122 Z S1), I have seen the following output while moving the axis with a G0 command
Why is it that there's values over 255? According to the docs for TMC2209, range for the stall guard threshold is 0-255. Also, this reporting stops while homing, is there any way to enable it while homing to enable for better debugging? |
I am not able to dig into this until I am back home later in the month, however this issue may contain some clues.
You should monitor the StallGuard value while moving with G1 and feedrates equal to the homing rates you intend to use.
IIRC not easily as the limit switches are polled at a high frequency and reporting is disabled to not put a limit on it. Did you use default parameter values for Klipper or did you modify any (of interest are Triniamic related values, homing feedrates and acceleration)? |
Hi
Is it possible to support, 64 pin STM32F103RC with 256 Kbytes of Flash memory? so I want to use BTT SKR MINI E3 V2.0 3D printer board.
https://www.bigtree-tech.com/products/bigtreetech-skr-mini-e3-v2-0-32-bit-control-board-integrated-tmc2209-uart-for-ender-3.html
The text was updated successfully, but these errors were encountered: