-
Notifications
You must be signed in to change notification settings - Fork 1k
[New Variant]STM32F401 #594
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
Comments
@mrguen, I have the RCT6 variant working on my system with v1.61 but haven't create a PR yet. I you want the variant file package and changes boards.txt file, I can post it. |
@pkourany Oh, Thanks a lot. That would be nice of you. |
This comment has been minimized.
This comment has been minimized.
Ok, Thanks Paul. The issue was open for STM32F401... I don't know if these files might help for the RCT6 type... |
Oh boy. I must have dyslexia cause I read F103RCT6 somehow! I'm going to hide that post since it isn't relevant. BTW, a lot of the work is done by STM32CubeMX by creating a project for the MCU/package you want, configuring the clock for internal/external crystals and creating the code for that variant you want. From this, you can get the code to copy to the ldscript.ld file and the clock configuration code (from main.c) to place in the variant.c file. The PeripheralPins.c and PinNamesVar.h files for all variants can be obtained here. The variant.c and variant.h files can be adapted to a simple list of pin names.
You will also need to review other #defines in variant.h to match the pin counts, # of analog pins, LED pin, etc. The last thing is to add the variant to the boards.txt file so it appears in the menu. |
Ok. I tried to do it by following your method and https://github.com/stm32duino/wiki/wiki/Add-a-new-variant-(board) A) ************** So I added #if defined(STM32F401xC) and uncommented #define STM32F401xC B) ************** ################################################################################ Generic F4GenF4.name=Generic STM32F4 series GenF4.build.vid=0x0483 Secret Garden F401RCGenF4.menu.pnum.STM32F401RCT6=Secret Garden F401RCT6 C) ************** WARNING: Category 'Language' in library ArduinoStreaming is not valid. Setting to 'Uncategorized' In file included from C:\Users\TG\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.6.1\system/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:30, In file included from C:\Users\TG\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.6.1\cores\arduino/stm32/stm32_def.h:35, In file included from C:\Users\TG\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.6.1\system/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rtc.h:29, In file included from C:\Users\TG\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.6.1\system/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_gpio.h:29, exit status 1 |
@mrguen can you zip your variant directory and share here? |
Here it is: STM32F401RCT6.zip |
Here is what I have done :
· Activated USART1 Asynchronous
In fact I am using this board https://fr.aliexpress.com/item/32894670982.html?spm=a2g0s.9042311.0.0.27426c37RrpWiJ and really don’t know their pin mapping. I have asked them a documentation… I suppose I can manage with the Nucleo numbering. I only changed the BOOT1 that was not considered on the NUCLEO board.
Secret Garden F401RCGenF4.menu.pnum.STM32F401RCT6=Secret Garden F401RCT6
#if defined(STM32F401xC) And uncomment #define STM32F401xC |
The seller sent me the link to the documentation : https://wetransfer.com/downloads/493b7605d31718be87a56133e7cc70d920190814152406/f44f44?spm=a2g0s.imconversation.0.0.7d7a3e5fzulqrL There is a lot of material. Including an STM32CubeMX project that I used to replace ldscript.ld and · SystemClock_Config() The compile error is still the same. |
Do not modify the core file.
|
I modified the boards.txt as explained but the error is still raised. |
It seems you have an preprocessor directive issue, missing #endif or something like that. |
Ok, Thanks, I let a #if instead of changing to #elif in stm32f4xx.h Now, despite the #define STM32F401xC in stm32f4xx.h it seems to be unknown by stm32_def_build.h In file included from C:\Users\TG\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.6.1\cores\arduino\stm32\startup_stm32yyxx.S:1: |
Hi @mrguen
There is no plan for this. This is a community project and all contributions are welcome.
In fact, variant is mainly how you order the pin (pin mapping) and linked to a board. Then the board determines the package used. |
@fpistm Ok, so if you can help me debug I will provide these... |
About your build issue, as I mentioned you don't have to modify the core files.
Using your variant and updating properly the boards.txt there is no build issue. |
It still raises en error: In file included from C:\Users\TG\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.6.1\cores\arduino\stm32\startup_stm32yyxx.S:1: |
Well, it's also written this: Arduino_Core_STM32/system/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h Lines 112 to 114 in 6d9575e
Please, come back to original core files and only update your variant and boards.txt as described in the wiki. |
Fixes stm32duino#594 Co-authored-by: Thierry GUENNOU <[email protected]> Signed-off-by: Frederic.Pillon <[email protected]>
@mrguen , |
Fixes stm32duino#594 Co-authored-by: Thierry GUENNOU <[email protected]> Signed-off-by: Frederic.Pillon <[email protected]>
Thanks. I could compile blink. |
@mrguen |
@fpistm: do you have a test protocol? |
Well, I have to deploy a test bench but don't have time yet to do it with a tests lists. 😭 |
Well, I think you have a driver issue. "STM device in DFU mode" should be "STM32 BOOTLOADER" |
You can try the driver provided with the tool: |
Yes, it is working now. |
Fine. |
Hello @fpistm ! I am reviewing PeripheralPins.c and I can see that Some timers functions are defined on two pins but other that could use 2 pins are defined on one pin only. Some timer signals are missing a pin (BKIN, ETR) etc... Should the timers definition section list all pins/functions possible as referenced in "STM32F401xB STM32F401xC" datasheet? |
The file is generated automatically and provides only used signal. BKIN and ETR are ignored when extracted. If they are required later they could be added. As you can see here only TIMx_CH are kept: if "_CH" in signal: |
For example TIM2_CH1 is defined for PA0 and PA5 while PA0 could be used for TIM5_CH1 which is not mapped. Can I change it / is there any other impact?
|
Yes as you can see the CHxN are also included as the test check if _CH is contained in the signal name...
Do what you want, the array is also WEAK so you can override it at sketch level to fit your needs and save memory space.
PA11/12 are for USB so I comment it. PD5/6 does not exist.
If a pin is not connected to dedicated hardware then we could provide all possible functions. |
Also I just realize that the files you provided are not those from https://github.com/stm32duino/Arduino_Tools/tree/master/src/genpinmap/Arduino/STM32F401R(B-C)Tx |
Here is the proposed PeripheralPins.c |
I see two differences in the ldcript provided as compared to Altium's:
|
The proposed PeripheralPins.c discards TIM9, TIM10 and TIM11 but I see in variant.cpp So it might be necessary to reactivate |
Here is the updated PeripheralPins.c + excel sheet detailing the code review |
About BOOT configuration: |
So far I have tested: Passed: Not ok: |
This is correct.
No, there is no link between Tone or Servo and the Pinmap PWM array which is used for
Right this is normal... to start the program you have to come back to default Boot pattern else you start in Bootloader mode...
For IWDG and eeprom I've tested a F401RE without any issue. |
Your update of PeripheralPins.c is not correct and I don't understand why you do this. |
PeripheralPins.c is the file from https://github.com/stm32duino/Arduino_Tools/tree/master/src/genpinmap/Arduino/STM32F401R(B-C)Tx It seems the other lacked some pin/timer mapping (maybe I am wrong of course I don't know this as you do) With pin arbitration between Timers defined as in the excel file in the .zip. |
I will do some other things tomorrow and come back to this afterward if you'd like. |
This is the same files except the commented lines... |
Yes possibly but I find it nice to have all possible mappings written. I have checked all are correct / datasheet and chose to promote TIM2 and TIM5 instead of TIM9/10/11 because they are 32 bits and that is what I am looking for with this IC ! |
Well as said the PWM array is for |
Thanks for the info... I am very much surprised. I will have a look at the library. Usually it is also possible to access the registers so I don't see why it wouldn't be 32 bits. |
For the provided API 16 bits is enough. For further use case HAL/LL could be used. |
Fixes stm32duino#594 Co-authored-by: Thierry GUENNOU <[email protected]> Signed-off-by: Frederic.Pillon <[email protected]>
Fixes stm32duino#594 Co-authored-by: Thierry GUENNOU <[email protected]> Signed-off-by: Frederic.Pillon <[email protected]>
Fixes #594 Co-authored-by: Thierry GUENNOU <[email protected]> Signed-off-by: Frederic.Pillon <[email protected]>
Helllo, Thanks for the huge quantity of work!
I would like to know if you plan to include in the release 1.7.0 these generic variants for F401
STM32F401CC in UFQFPN48 and LQFP64 packages
STM32F401RCT6 in LQFP64 package
Generally speaking how do you handle the different packages versions?
The text was updated successfully, but these errors were encountered: