-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
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
[BUG] Problem with timer TIM6 and missing definitions of digitalPin and SystemClock_Config functions for STEVAL_F401VE variant #16563
Comments
At last I managed to successfully compile and link the MarlinFirmware for STEVAL-3DP001V1 board using variant files for STM32F401VE extracted from GitHub repository stm32duino/Arduino_Core_STM32 where I found a profile for the board (https://github.com/stm32duino/Arduino_Core_STM32/tree/master/variants/ST3DP001_EVAL). |
I have not been able to reproduce the problem. I downloaded the latest bugfix-2.2.x, added in your configuration files and then compiled using Platformio within Atom. No compile errors. I then changed the three files & re-compiled. Again no erors. I then opened the project in VScode, deleted the build and compiled. No compile errors. I suggest downloading a fresh copy of bugfix. It now has the L6474 support plus some STEVAL pin fixes. If that doesn't compile then get a fresh copy of the .platformio\packages\framework-arduinoststm32 package by deleting that directory and re-compiling. FYI - PR #16565 has an updated pins file. It has the correct definitions for the analog inputs. The on-board SD card isn't yet available. That's next on my list. |
ON-board SD card access was easier than I expected. Replace the following files with the attached.
I'll create a PR for this change tomorrow. FYI - PR #16565 has been merged. |
@Bob-the-Kuhn, thanks for your answers Unfortunately following your instructions I am not able to compile/link even getting the last version of bugfix-2.0.x. I've also forced the update of .platformio\packages\framework-arduinoststm32 whitout success. The only way to compile/link correctly is to point to 3DP001V1_STEVAL folder in .platformio\packages\framework-arduinoststm32\variants changing the board_dir value in [platformio] section of platformio.ini or copying folder 3DP001V1_STEVAL into .buildroot\share\PlatformIO\variants. Please note also that if I substitute files pins_STEVAL_3DP001V1.h and HAL_SPI.cpp I obtain a lot of pin redefinition warnings for SDSS pin in pins_STEVAL_3DP001V1.h (lines 247 and 171) and programming the board with the generated firmware makes it unstable (it is reset by the Watchdog approximately every 3-4 secs): ` echo: Last Updated: 2020-01-15 | Author: (none, default config) echo:Filament settings: Disabled echo: Last Updated: 2020-01-15 | Author: (none, default config) echo:Filament settings: Disabled echo: Last Updated: 2020-01-15 | Author: (none, default config) echo:Filament settings: Disabled start echo: Last Updated: 2020-01-15 | Author: (none, default config) echo:Filament settings: Disabled echo: Last Updated: 2020-01-15 | Author: (none, default config) |
I'm at a loss to explain why you can't compile. I suggest starting over from scratch:
Another possibility is to compile with the Arduino IDE. |
All steps done without success... |
The on-board SD card access changes are on PR #16579 |
I've finally been able to reproduce the problem. You are correct - variant.cpp is missing. Below is the file. The build process copies my custom variant folder over to the platformio variant and then uses that during the build. Apparently I created the variant.cpp file early in my work and then "lost" it. But since it was hiding under platformio copy I didn't realize it was missing. Another PR coming to fix it. |
remember to mention issue in PR so we can see when PR is merged :-D |
Perfect, thank you @Bob-the-Kuhn ; finally I'm able to compile/link Marlin for STEVAL-3DP001V1 without errors! |
Please post your configuration files & I'll see if I can spot something. |
Here they are: Please note that downloading and compiling Marlin from your branch https://github.com/Bob-the-Kuhn/Marlin-Bob-2/tree/STM32---add-soft-SPI-so-can-access-on-board-SD-cards-on-STM32F4xx-and-STM32F7xx-boards, and using the attached config files, compilation goes well, the board doesn't restart periodically due to whatchdog error, the SD card works (SD Card Init OK, and I'm able to list its content with M22 command), but motors don't spin. `start echo: Last Updated: 2020-01-15 | Author: (none, default config) echo:Filament settings: Disabled If I give command M17 to enable steppers I don't hear the typical "bump" due to the first energize of their coils. If I give command G0 X10 Y10 Z10 E10 to make motors move, they don't spin but if I give command
|
The L6474 stepper drivers hadn't been selected in Configuration.h and the SPI chain hadn't been setup in Configuration_adv.h. Please try these modified files. Do you have any steppers connected besides X, Y, Z and E0? If yes I'll modify the config files accordingly. Please post the results of the M122 and M906 commands. That'll tell me if the SPI chain is working. FYI - I've also enabled the X2 and Y2 stepper drivers because having 6 steppers in the chain is the simplest hardware (don't need to install R16 & R17). |
It works! ` echo: Last Updated: 2020-01-15 | Author: (none, default config) echo:Filament settings: Disabled M122 M906 AXIS: X2 status: ff83 1111 1111 1000 0011 AXIS: Y status: ff93 1111 1111 1001 0011 AXIS: Y2 status: ff83 1111 1111 1000 0011 AXIS: Z status: ff93 1111 1111 1001 0011 AXIS: E0 status: ff93 1111 1111 1001 0011 ok |
FANTASTIC!!! Please close this if you think we're done. |
I tried to set the current limit with the M906 command but it appears to don't work M906 X500 Y500 Z500 to limit the current for XYZ axes to 500 mA and then ask again their values with M906 I obtain the same output of my last post. In any case I think that for clarity, should this problem be confirmed, it can be treated with another bug report; do you agree? |
Bug is confirmed. It is treating the numbers as TVAL counts. Current is (TVAL + 1) * 31.25ma The M906 description is definitely wrong. I'm not sure yet how I'm going to change it yet. on a L6474 TVAL directly affect peak current. All the others this sets KVAL_HOLD which affects the voltage PWM duty cycle which affects the current. There's a couple of ways you can handle this:
|
Here is the correct code. It replaces the following file: UPDATE: this has been merged into Bugfix-2.0.x |
Thank you very much for your assistance and willingness! |
Ooooops, unfortunately when the modified M906.cpp is substituted to the original one, I get a compilation error:
|
That is not what I wanted to hear. ### 😞 Now to figure out how to reproduce the problem on my walking wounded board ... |
If you like I can test your mods on my board; the only problem can be with the time zone (I'm in Italy). Testing in depth the M906 command, it seems that the write command works but ther read doesn't work. `M906 ...KVAL_HOLD: NA KVAL_RUN : NA KVAL_ACC: NA KVAL_DEC: NA V motor max = NA AXIS: Y status: 180 0000 0001 1000 0000 ...KVAL_HOLD: NA KVAL_RUN : NA KVAL_ACC: NA KVAL_DEC: NA V motor max = NA AXIS: Z status: 180 0000 0001 1000 0000 ...KVAL_HOLD: NA KVAL_RUN : NA KVAL_ACC: NA KVAL_DEC: NA V motor max = NA AXIS: E0 status: 180 0000 0001 1000 0000 ...KVAL_HOLD: NA KVAL_RUN : NA KVAL_ACC: NA KVAL_DEC: NA V motor max = NA ok` |
You definitely uncovered a strange one. As long as X_DUAL_STEPPER_DRIVERS there will be a compile error. Doesn't matter what stepper driver is selected. Try replacing this file with the attached: \Marlin\src\core\drivers.h |
After the drivers.h substitution Marlin compiles without error ever re-enabling lines 668 and 669 in Marlin\Configuration.h. |
Please ZIP & attach your M122 and M906 results. |
Here is the log of a command session in text format where you can see the behaviour of M122/M906 commands when I change the value of stall current of X axis. As you can see the TVAL value reported by M906 command is always 0 (corresponding to a stall current of 31.25 mA) , even if I reprogram the axis current to 300 mA. Please, feel free to ask me for other tries! |
Your SPI chain is not working. The status print hex and binary values should look something like this:
Assuming that you are using the last config files you posted, I don't understand the problem. They look correct. Please post your pins_STEVAL_3DP001V1.h file. maybe the problem is there. Hmmm .... looks like the M906 status prints are wrong. They should be the same as the M122 results. One more bug! |
Here's the corrected M906. |
Please delete the .platformio\packages\framework-arduinoststm32 directory and the .pio directory & see if the SWITCH_ENABLED_DUAL_X_CARRIAGE errors go away. They disappeared for me when I deleted those two directories. |
Please note that I don't have anymore errors related to SWITCH_ENABLED_DUAL_X_CARRIAGE after the substitution of the drivers.h files you shared yesterday here https://www.dropbox.com/s/bo4b4zcdwq35ugo/drivers.zip?dl=0. Probably the problem is related to the pins_STEVAL_3DP001V1.h file; if I use this version If I use this version (included in the current bugfix-2.0.x) |
@fradaxx so this one is solved ? |
@boelle no, unfortunately the problem with M906 command persists: it seems that it works only in "write" mode but not in read mode. Stall currents appear to be correctly configured but not correctly read because the M906 command (whitout arguments) returns always all 0s. |
no no, we now know it could be a week or 2 before you report back :-D |
Lack of Activity |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug Description
Trying to compile the bugfix-2.0.x version for the STEVAL-3DP001V1 board with PlatformIO, I first obtain errors on TIM6 timer which doesn't exist in the F401VE processor. I solved this first problem thanks to @Bob-the-Kuhn changing TIM6 to another unused timer but nonetheless the compilation succedees, the final linking fails with many errors due to undefined references to digitalPin and SystemClock_Config functions:
`...
Compiling .pio\build\STM32F401VE_STEVAL\src\src\sd\usb_flashdrive\lib-uhs2\usbhost.cpp.o
Linking .pio\build\STM32F401VE_STEVAL\firmware.elf
.pio/build/STM32F401VE_STEVAL/FrameworkArduino/HardwareSerial.cpp.o: In function
HardwareSerial::HardwareSerial(void*)': C:\Users\Francesco\.platformio\packages\framework-arduinoststm32\cores\arduino/HardwareSerial.cpp:226: undefined reference to
digitalPin'.pio/build/STM32F401VE_STEVAL/FrameworkArduino/pins_arduino.c.o: In function
analogInputToPinName': C:\Users\Francesco\.platformio\packages\framework-arduinoststm32\cores\arduino/pins_arduino.c:61: undefined reference to
digitalPin'.pio/build/STM32F401VE_STEVAL/FrameworkArduino/stm32/hw_config.c.o: In function
hw_config_init': C:\Users\Francesco\.platformio\packages\framework-arduinoststm32\cores\arduino\stm32/hw_config.c:63: undefined reference to
SystemClock_Config'.pio/build/STM32F401VE_STEVAL/FrameworkArduino/stm32/usb/usbd_conf.c.o: In function
HAL_PCD_ResumeCallback': C:\Users\Francesco\.platformio\packages\framework-arduinoststm32\cores\arduino\stm32\usb/usbd_conf.c:325: undefined reference to
SystemClock_Config'.pio/build/STM32F401VE_STEVAL/FrameworkArduino/stm32/usb/usbd_conf.c.o: In function
OTG_FS_WKUP_IRQHandler': C:\Users\Francesco\.platformio\packages\framework-arduinoststm32\cores\arduino\stm32\usb/usbd_conf.c:434: undefined reference to
SystemClock_Config'.pio/build/STM32F401VE_STEVAL/FrameworkArduino/wiring_analog.c.o: In function
analogWrite': C:\Users\Francesco\.platformio\packages\framework-arduinoststm32\cores\arduino/wiring_analog.c:133: undefined reference to
digitalPin'.pio/build/STM32F401VE_STEVAL/FrameworkArduino/wiring_digital.c.o: In function
pinMode': C:\Users\Francesco\.platformio\packages\framework-arduinoststm32\cores\arduino/wiring_digital.c:76: undefined reference to
digitalPin'.pio/build/STM32F401VE_STEVAL/FrameworkArduino/wiring_digital.c.o: In function
LL_GPIO_ResetOutputPin': C:\Users\Francesco\.platformio\packages\framework-arduinoststm32\system\Drivers\STM32F4xx_HAL_Driver\Inc/stm32f4xx_ll_gpio.h:913: undefined reference to
digitalPin'.pio/build/STM32F401VE_STEVAL/FrameworkArduino/wiring_digital.c.o: In function
digitalRead': C:\Users\Francesco\.platformio\packages\framework-arduinoststm32\cores\arduino/wiring_digital.c:86: undefined reference to
digitalPin'.pio/build/STM32F401VE_STEVAL/src/src/HAL/HAL_STM32/fastio.cpp.o: In function
FastIO_init()': c:\Users\Francesco\Desktop\MarlinFirmware/Marlin\src\HAL\HAL_STM32/fastio.cpp:32: undefined reference to
digitalPin'.pio/build/STM32F401VE_STEVAL/src/src/MarlinCore.cpp.o:c:\Users\Francesco\Desktop\MarlinFirmware/Marlin\src/MarlinCore.cpp:295: more undefined references to `digitalPin' follow
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\STM32F401VE_STEVAL\firmware.elf] Error 1
====================================================================================== [FAILED] Took 91.85 seconds ======================================================================================
Environment Status Duration
megaatmega2560 IGNORED
megaatmega1280 IGNORED
rambo IGNORED
FYSETC_F6_13 IGNORED
FYSETC_F6_14 IGNORED
sanguino_atmega644p IGNORED
sanguino_atmega1284p IGNORED
melzi IGNORED
melzi_optiboot IGNORED
at90usb1286_cdc IGNORED
at90usb1286_dfu IGNORED
DUE IGNORED
DUE_USB IGNORED
DUE_debug IGNORED
LPC1768 IGNORED
LPC1769 IGNORED
STM32F103RC IGNORED
STM32F103RC_fysetc IGNORED
STM32F103RC_bigtree IGNORED
STM32F103RC_bigtree_USB IGNORED
STM32F103RC_bigtree_512K IGNORED
STM32F103RC_bigtree_512K_USB IGNORED
STM32F103RE IGNORED
STM32F103RE_bigtree IGNORED
STM32F103RE_bigtree_USB IGNORED
STM32F4 IGNORED
STM32F7 IGNORED
STM32F401VE_STEVAL FAILED 00:01:31.848
ARMED IGNORED
STM32F103VE_GTM32 IGNORED
STM32F103VE_longer IGNORED
mks_robin_mini IGNORED
mks_robin_nano IGNORED
mks_robin IGNORED
mks_robin_pro IGNORED
mks_robin_lite IGNORED
mks_robin_lite3 IGNORED
jgaurora_a5s_a1 IGNORED
STM32F103CB_malyan IGNORED
chitu_f103 IGNORED
FLYF407ZG IGNORED
FYSETC_S6 IGNORED
STM32F407VE_black IGNORED
BIGTREE_SKR_PRO IGNORED
BIGTREE_BTT002 IGNORED
teensy31 IGNORED
teensy35 IGNORED
esp32 IGNORED
linux_native IGNORED
SAMD51_grandcentral_m4 IGNORED
rumba32_f446ve IGNORED
mks_rumba32 IGNORED
include_tree IGNORED
================================================================================= 1 failed, 0 succeeded in 00:01:31.848 =================================================================================
The terminal process terminated with exit code: 1
Terminal will be reused by tasks, press any key to close it.
`
My Configurations
configuration.zip
Steps to Reproduce
\Marlin\src\HAL\HAL_STM32\timers.h (lines 66 & 70)
\buildroot\share\PlatformIO\variants\STEVAL_F401VE\variant.h ( lines 196 & 199)
to use timers effectively present in the F401VE microcontroller.
Expected behavior:
The code should compile and link finely.
Actual behavior:
Code compiles but final linking fails with various errors about digitalPin and SystemClock_Config missing references.
I think that implementations of both these functions (as per other variants based on STM32 microcontrollers) should be given, besides other ones, in a variant.cpp file contained in the variant folder devoted to the board (.\buildroot\share\PlatformIO\variants\STEVAL_F401VE). Currently in this folder I see only the attached content:
STEVAL_F401VE.zip
The text was updated successfully, but these errors were encountered: