[En-Nut-Discussion] A few patches

Krzysztof Sawicki krzysztof.sawicki at mlabs.pl
Mon Dec 12 09:11:54 CET 2016


ADD: STM32F412Rx
FIX: UART/SPI/DMA/RTC config for STM32

-- 
Krzysztof Sawicki
MLabs sp. z o.o.
ul. Kaliska 21
61-131 Poznań

tel. 61 646 84 27

KRS: 0000390306
NIP: 7822533401
-------------- next part --------------
Index: conf/arch/cm3/stm32pll.nut
===================================================================
--- conf/arch/cm3/stm32pll.nut	(revision 6567)
+++ conf/arch/cm3/stm32pll.nut	(working copy)
@@ -783,7 +783,7 @@
         },
         {
             macro = "HSE_VALUE",
-            brief = "External Oszillator Frequency",
+            brief = "External Oscillator Frequency",
             description = function() return GetHseValueDesc() end,
             type = "integer",
             provides = {"HSE_VALUE"},
Index: conf/arch/cm3/stm32spi.nut
===================================================================
--- conf/arch/cm3/stm32spi.nut	(revision 6567)
+++ conf/arch/cm3/stm32spi.nut	(working copy)
@@ -426,7 +426,8 @@
 -- SPI1 TX
 function GetSpi1TxDmaChoices()
     if c_is_provided("HW_DMA_STM32F2") then
-        return {"(DMA_CONTROL2 | DMA_STREAM3 | DMA_CHANNEL3)",
+        return {"(DMA_CONTROL2 | DMA_STREAM2 | DMA_CHANNEL2)",
+                "(DMA_CONTROL2 | DMA_STREAM3 | DMA_CHANNEL3)",
                 "(DMA_CONTROL2 | DMA_STREAM5 | DMA_CHANNEL3)",
                 "DMA_NONE"}
         end
@@ -626,7 +627,7 @@
     --
     {
         name = "nutarch_cm3_stm32f_spi1",
-        brief = "STM32 SPI1 Bus Controller",
+        brief = "STM32F SPI1 Bus Controller",
         description = "First SPI Controller with up to four Chip select line.",
         requires = { "HW_SPI1_STM32" },
         provides = { "SPIBUS_CONTROLLER", "HW_SPI_STM32" },
@@ -668,9 +669,7 @@
                 description = "Choice of SPI1 CS0 Gpio.\n"..
                               "Default is default NSS pin.\n"..
                               "Use PIN_NONE if no CS is required.\n",
-                type = "enumerated",
-                choices = {"PIN_NONE", "PA04"},
-                default = "PA04",
+                default = "PIN_NONE",
                 file = "include/cfg/spi.h"
             },
             {
Index: conf/arch/cm3/stm32usart.nut
===================================================================
--- conf/arch/cm3/stm32usart.nut	(revision 6567)
+++ conf/arch/cm3/stm32usart.nut	(working copy)
@@ -129,6 +129,9 @@
     if c_is_provided("HW_MCU_STM32F411") then
         return { "", "USART1", "USART2",                               "USART6" }
     end
+    if c_is_provided("HW_MCU_STM32F412") then
+        return { "", "USART1", "USART2", "USART3",                   "USART6"}
+    end
     if c_is_provided("HW_MCU_STM32F40") then
         return { "", "USART1", "USART2", "USART3", "UART4", "UART5", "USART6"}
     end
@@ -174,6 +177,9 @@
     if c_is_provided("HW_MCU_STM32F411") then
         return { "PA09", "PB06", "PA15", "PIN_NONE" }
     end
+    if c_is_provided("HW_MCU_STM32F412") then
+        return { "PA09", "PB06", "PA15", "PIN_NONE" }
+    end
      if c_is_provided("HW_MCU_STM32L4") then
         return { "PA09", "PB06", "PG09", "PIN_NONE" }
     end
@@ -196,6 +202,9 @@
     if c_is_provided("HW_MCU_STM32F411") then
         return { "PA10", "PB07", "PB03", "PIN_NONE" }
     end
+    if c_is_provided("HW_MCU_STM32F412") then
+        return { "PA10", "PB07", "PB03", "PIN_NONE" }
+    end
     if c_is_provided("HW_MCU_STM32L4") then
         return { "PA10", "PB07", "PG10", "PIN_NONE" }
     end
@@ -265,6 +274,9 @@
     if c_is_provided("HW_MCU_STM32F446") then
         return { "PB11", "PC11", "PC05", "PD09", "PIN_NONE"}
     end
+    if c_is_provided("HW_MCU_STM32F412") then
+        return { "PB11", "PC11", "PC05", "PD09", "PIN_NONE"}
+    end
     if c_is_provided("HW_MCU_STM32L4") then
         return { "PB11", "PC11", "PC05", "PD09", "PIN_NONE" }
     end
@@ -281,6 +293,9 @@
    if c_is_provided("HW_MCU_STM32F446") then
         return { "PB13", "PD11", "PIN_NONE"}
    end
+   if c_is_provided("HW_MCU_STM32F412") then
+        return { "PB13", "PD11", "PIN_NONE"}
+   end
    if c_is_provided("HW_MCU_STM32L4") then
         return { "PB13", "PA06", "PD11", "PIN_NONE" }
    end
@@ -435,6 +450,9 @@
    if c_is_provided("HW_MCU_STM32F401") then
         return { "PC07", "PA12", "PIN_NONE" }
    end
+   if c_is_provided("HW_MCU_STM32F412") then
+        return { "PC07", "PA12", "PG09", "PIN_NONE" }
+   end
    if c_is_provided("HW_MCU_STM32F446") then
         return { "PC07", "PG09", "PIN_NONE" }
    end
@@ -454,6 +472,9 @@
     if c_is_provided("HW_MCU_STM32F401") then
         return { "PC06", "PA11", "PIN_NONE" }
     end
+    if c_is_provided("HW_MCU_STM32F412") then
+        return { "PC06", "PA11", "PG14", "PIN_NONE" }
+    end
     return { "PC06", "PG14", "PIN_NONE" }
 end
 function GetTxUsart6Default()
@@ -556,7 +577,8 @@
 function GetUsart2RxDmaChoices()
     if c_is_provided("HW_DMA_STM32F2") then
         return {"DMA_NONE",
-                "(DMA_CONTROL1 | DMA_STREAM5 | DMA_CHANNEL4)"}
+                "(DMA_CONTROL1 | DMA_STREAM5 | DMA_CHANNEL4)",
+                "(DMA_CONTROL1 | DMA_STREAM7 | DMA_CHANNEL6)"}
         end
     if c_is_provided("HW_DMA1_STM32F0") then
         return {"DMA_NONE", "DMA1_CH5"}
@@ -691,8 +713,8 @@
 function GetUsart6TxDmaChoices()
     if c_is_provided("HW_DMA_STM32F2") then
         return {"DMA_NONE",
-                "(DMA_CONTROL2 | DMA_STREAM1 | DMA_CHANNEL5)",
-                "(DMA_CONTROL2 | DMA_STREAM2 | DMA_CHANNEL5)"}
+                "(DMA_CONTROL2 | DMA_STREAM6 | DMA_CHANNEL5)",
+                "(DMA_CONTROL2 | DMA_STREAM7 | DMA_CHANNEL5)"}
         end
     if c_is_provided("HW_DMA1_2_STM32F09") then
         return {"DMA_NONE",
@@ -705,8 +727,8 @@
 function GetUsart6RxDmaChoices()
     if c_is_provided("HW_DMA_STM32F2") then
         return {"DMA_NONE",
-                "(DMA_CONTROL2 | DMA_STREAM6 | DMA_CHANNEL5)",
-                "(DMA_CONTROL2 | DMA_STREAM7 | DMA_CHANNEL5)"}
+                "(DMA_CONTROL2 | DMA_STREAM1 | DMA_CHANNEL5)",
+                "(DMA_CONTROL2 | DMA_STREAM2 | DMA_CHANNEL5)"}
         end
     if c_is_provided("HW_DMA1_2_STM32F09") then
         return {"DMA_NONE",
@@ -980,7 +1002,7 @@
                               "If selected, check for collision with other DMA!\n"..
                               "Default is DMA_NONE to not use DMA.\n",
                 type = "enumerated",
-                choices = function() return GetUsart1TxDmaChoices() end,
+                choices = function() return GetUsart1RxDmaChoices() end,
                 default = "DMA_NONE",
                 file = "include/cfg/uart.h"
             },
Index: include/arch/cm3/stm/stm32_clk.h
===================================================================
--- include/arch/cm3/stm/stm32_clk.h	(revision 6567)
+++ include/arch/cm3/stm/stm32_clk.h	(working copy)
@@ -59,7 +59,7 @@
 #   else
 #    define RTC_PRE      2
 #   endif
-#  elif defined(RCC_CFGR_RTCPR)
+#  elif defined(RCC_CFGR_RTCPRE)
 /* F2/F4 has HSE prescaler 2.. 32*/
 #   if HSE_VALUE <= 2000000
 #    define RTC_PRE 2


More information about the En-Nut-Discussion mailing list