diff --git a/STM/inbyggda_system/Core/Src/main.c b/STM/inbyggda_system/Core/Src/main.c index 7196ca94f35b64a9cc4570ca3c20bbf29844c819..2f8366bb9a877d99440d6d778d663557d4e4095c 100644 --- a/STM/inbyggda_system/Core/Src/main.c +++ b/STM/inbyggda_system/Core/Src/main.c @@ -179,8 +179,14 @@ static void MX_GPIO_Init(void) /* GPIO Ports Clock Enable */ __HAL_RCC_GPIOH_CLK_ENABLE(); __HAL_RCC_GPIOC_CLK_ENABLE(); - __HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); + __HAL_RCC_GPIOA_CLK_ENABLE(); + + /*Configure GPIO pin : PC1 */ + GPIO_InitStruct.Pin = GPIO_PIN_1; + GPIO_InitStruct.Mode = GPIO_MODE_INPUT; + GPIO_InitStruct.Pull = GPIO_NOPULL; + HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); /*Configure GPIO pins : PC2 PC3 */ GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3; @@ -190,12 +196,6 @@ static void MX_GPIO_Init(void) GPIO_InitStruct.Alternate = GPIO_AF5_SPI2; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); - /*Configure GPIO pin : PA0 */ - GPIO_InitStruct.Pin = GPIO_PIN_0; - GPIO_InitStruct.Mode = GPIO_MODE_INPUT; - GPIO_InitStruct.Pull = GPIO_NOPULL; - HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); - /*Configure GPIO pins : PB10 PB12 */ GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_12; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; diff --git a/STM/inbyggda_system/inbyggda_system.ioc b/STM/inbyggda_system/inbyggda_system.ioc index 244da4553e983b1e9e1005fbe8f2dc98c5edbfc8..d54dc6d6d988a44c67bb284e6aeb28ceb143e5e5 100644 --- a/STM/inbyggda_system/inbyggda_system.ioc +++ b/STM/inbyggda_system/inbyggda_system.ioc @@ -10,7 +10,7 @@ Mcu.PinsNb=14 ProjectManager.NoMain=false RCC.PLLCLKFreq_Value=96000000 RCC.PLLQCLKFreq_Value=48000000 -ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false +ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USB_OTG_FS_USB_Init-USB_OTG_FS-false-HAL-true PC2.Signal=SPI2_MISO PA11.Mode=OTG/Dual_Role_Device PC3.Locked=true @@ -18,13 +18,13 @@ RCC.RTCFreq_Value=32000 ProjectManager.DefaultFWLocation=true PB12.Locked=true ProjectManager.DeletePrevious=true +PC1.Locked=true PB10.Locked=true PH1\ -\ OSC_OUT.Locked=true PinOutPanel.RotationAngle=0 RCC.FamilyName=M ProjectManager.StackSize=0x400 -PA0-WKUP.Signal=GPIO_Input -PA0-WKUP.Locked=true +RCC.PLLSource=RCC_PLLSOURCE_HSI PA13.Signal=SYS_JTMS-SWDIO Mcu.IP2=SYS NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false @@ -56,10 +56,10 @@ RCC.AHBFreq_Value=16000000 Mcu.Pin0=PH0 - OSC_IN Mcu.Pin1=PH1 - OSC_OUT GPIO.groupedBy= -Mcu.Pin2=PC2 +Mcu.Pin2=PC1 PB10.Signal=SPI2_SCK -Mcu.Pin3=PC3 -Mcu.Pin4=PA0-WKUP +Mcu.Pin3=PC2 +Mcu.Pin4=PC3 RCC.VCOI2SOutputFreq_Value=192000000 Mcu.Pin5=PB10 ProjectManager.ProjectBuild=false @@ -82,7 +82,7 @@ VP_SYS_VS_Systick.Mode=SysTick NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false ProjectManager.FreePins=false -RCC.IPParameters=AHBFreq_Value,APB1Freq_Value,APB2Freq_Value,CortexFreq_Value,FamilyName,HSE_VALUE,HSI_VALUE,I2SClocksFreq_Value,LSE_VALUE,LSI_VALUE,PLLCLKFreq_Value,PLLQCLKFreq_Value,PLLSourceVirtualString,RTCFreq_Value,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOInputMFreq_Value,VCOOutputFreq_Value,VcooutputI2S +RCC.IPParameters=AHBFreq_Value,APB1Freq_Value,APB2Freq_Value,CortexFreq_Value,FamilyName,HSE_VALUE,HSI_VALUE,I2SClocksFreq_Value,LSE_VALUE,LSI_VALUE,PLLCLKFreq_Value,PLLQCLKFreq_Value,PLLSource,RTCFreq_Value,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOInputMFreq_Value,VCOOutputFreq_Value,VcooutputI2S ProjectManager.AskForMigrate=true Mcu.Name=STM32F411R(C-E)Tx ProjectManager.HalAssertFull=false @@ -113,7 +113,6 @@ Mcu.Pin13=VP_SYS_VS_Systick ProjectManager.ComputerToolchain=false RCC.HSI_VALUE=16000000 NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 -RCC.PLLSourceVirtualString=RCC_PLLSOURCE_HSI Mcu.Pin11=PA14 Mcu.Pin12=PB3 Mcu.Pin10=PA13 @@ -121,6 +120,7 @@ NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false RCC.APB1Freq_Value=16000000 ProjectManager.CustomerFirmwarePackage= ProjectManager.DeviceId=STM32F411RETx +PC1.Signal=GPIO_Input PB12.Signal=SPI2_NSS ProjectManager.LibraryCopy=0 PB3.Locked=true diff --git a/lab1/lab1.sch b/lab1/lab1.sch index ca3af50ef33ed5121b5caa681a9e71c334eadd5e..f01a8a266449458df715fd29833a422248b21541 100644 --- a/lab1/lab1.sch +++ b/lab1/lab1.sch @@ -48,8 +48,6 @@ F 3 "~" H 6600 3150 50 0001 C CNN 1 6600 3150 0 1 1 0 $EndComp -Text Notes 5400 3750 0 50 ~ 0 -2*(Cload-Cstray)*2^(18-6)= 24pF = 22pF $Comp L Device:C C14 U 1 1 6009CA4A @@ -108,17 +106,6 @@ F 3 "~" H 9850 4550 50 0001 C CNN -1 0 0 -1 $EndComp $Comp -L power:+3.3V #PWR0104 -U 1 1 600A9E8A -P 9300 4350 -F 0 "#PWR0104" H 9300 4200 50 0001 C CNN -F 1 "+3.3V" H 9315 4523 50 0000 C CNN -F 2 "" H 9300 4350 50 0001 C CNN -F 3 "" H 9300 4350 50 0001 C CNN - 1 9300 4350 - 1 0 0 -1 -$EndComp -$Comp L power:GND #PWR0105 U 1 1 600AA4E2 P 9200 4550 @@ -133,16 +120,12 @@ Text GLabel 9600 4750 0 50 Input ~ 0 NRST Text GLabel 9600 4650 0 50 BiDi ~ 0 SWDIO -Text GLabel 9600 4450 0 50 Output ~ 0 -SWCLK Text GLabel 9600 4850 0 50 Input ~ 0 SWO Text GLabel 8650 3200 2 50 Input ~ 0 SWCLK Wire Wire Line 9650 4550 9200 4550 -Wire Wire Line - 9300 4350 9650 4350 Text GLabel 8650 3800 2 50 Output ~ 0 SWO Text GLabel 8650 3100 2 50 BiDi ~ 0 @@ -198,7 +181,7 @@ L Regulator_Linear:MIC5205-3.3YM5 U2 U 1 1 600F072A P 4150 2150 F 0 "U2" H 4150 2492 50 0000 C CNN -F 1 "PWM3389DM-T3QU" H 4150 2401 50 0000 C CNN +F 1 "MIC5335YM5-TR" H 4150 2401 50 0000 C CNN F 2 "Package_TO_SOT_SMD:SOT-23-5" H 4150 2475 50 0001 C CNN F 3 "http://ww1.microchip.com/downloads/en/DeviceDoc/20005785A.pdf" H 4150 2150 50 0001 C CNN 1 4150 2150 @@ -383,8 +366,6 @@ Wire Wire Line 9650 4750 9600 4750 Wire Wire Line 9650 4850 9600 4850 -Wire Wire Line - 9650 4450 9600 4450 Wire Notes Line 5350 6450 11200 6450 Wire Notes Line @@ -806,16 +787,16 @@ Connection ~ 4050 6900 Wire Wire Line 3300 6900 3650 6900 Wire Wire Line - 3400 6350 3400 6300 + 3400 5950 3400 5900 $Comp L power:+3.3V #PWR0129 U 1 1 6022F7BC -P 3400 6300 -F 0 "#PWR0129" H 3400 6150 50 0001 C CNN -F 1 "+3.3V" H 3415 6473 50 0000 C CNN -F 2 "" H 3400 6300 50 0001 C CNN -F 3 "" H 3400 6300 50 0001 C CNN - 1 3400 6300 +P 3400 5900 +F 0 "#PWR0129" H 3400 5750 50 0001 C CNN +F 1 "+3.3V" H 3415 6073 50 0000 C CNN +F 2 "" H 3400 5900 50 0001 C CNN +F 3 "" H 3400 5900 50 0001 C CNN + 1 3400 5900 1 0 0 -1 $EndComp $Comp @@ -1241,8 +1222,6 @@ Wire Wire Line 1250 6550 1450 6550 Wire Wire Line 1050 6250 1450 6250 -Wire Wire Line - 2050 6250 1450 6250 Connection ~ 1450 6250 Wire Wire Line 3000 5950 3050 5950 @@ -1251,23 +1230,21 @@ Wire Wire Line Wire Wire Line 2950 6050 3000 6050 Wire Wire Line - 3400 6350 3300 6350 + 3400 6350 3400 6250 Text GLabel 3050 5950 2 50 Input ~ 0 LED_P -Wire Wire Line - 3000 6350 2950 6350 Wire Wire Line 2000 6150 2050 6150 $Comp L Device:R R6 U 1 1 601285C0 -P 3150 6350 -F 0 "R6" V 3220 6396 50 0000 L TNN -F 1 "10kΩ" V 3220 6305 50 0000 C TNN -F 2 "" V 3080 6350 50 0001 C CNN -F 3 "~" H 3150 6350 50 0001 C CNN - 1 3150 6350 - 0 -1 -1 0 +P 3400 6100 +F 0 "R6" H 3470 6146 50 0000 L TNN +F 1 "10kΩ" H 3470 6055 50 0000 L TNN +F 2 "" V 3330 6100 50 0001 C CNN +F 3 "~" H 3400 6100 50 0001 C CNN + 1 3400 6100 + 1 0 0 -1 $EndComp $Comp L lab1:PWM3389 U4 @@ -1295,9 +1272,9 @@ F 3 "" H 2000 6650 50 0001 C CNN $EndComp Text GLabel 3000 6650 2 50 Output ~ 0 Motion -Text GLabel 8600 2900 2 50 BiDi ~ 0 +Text GLabel 8650 2900 2 50 BiDi ~ 0 DM -Text GLabel 8600 3000 2 50 BiDi ~ 0 +Text GLabel 8650 3000 2 50 BiDi ~ 0 DP Text GLabel 1750 4100 2 50 BiDi ~ 0 DM @@ -1401,16 +1378,11 @@ NoConn ~ 8600 4100 NoConn ~ 8600 4200 NoConn ~ 8600 4300 NoConn ~ 8600 4400 -NoConn ~ 8600 4500 -NoConn ~ 8600 4600 NoConn ~ 8600 4700 NoConn ~ 8600 4800 NoConn ~ 8600 4900 NoConn ~ 7200 3200 NoConn ~ 7200 3400 -NoConn ~ 7200 3500 -NoConn ~ 7200 3600 -NoConn ~ 7200 3700 NoConn ~ 7200 3800 NoConn ~ 7200 3900 NoConn ~ 7200 4000 @@ -1425,9 +1397,6 @@ NoConn ~ 7200 4800 NoConn ~ 7200 4900 NoConn ~ 1800 1150 NoConn ~ 1800 1250 -NoConn ~ 2950 6550 -NoConn ~ 2950 6450 -NoConn ~ 2950 6250 NoConn ~ 2050 6450 NoConn ~ 2050 6550 Wire Wire Line @@ -1447,14 +1416,6 @@ Wire Wire Line 2950 6650 3000 6650 Text GLabel 8600 1800 2 50 Input ~ 0 Motion -Wire Wire Line - 7100 3000 7200 3000 -Wire Wire Line - 6600 2900 7200 2900 -Wire Wire Line - 6900 2200 7200 2200 -Wire Wire Line - 7600 1600 7700 1600 Wire Wire Line 8000 1300 8100 1300 Wire Wire Line @@ -1479,4 +1440,76 @@ F 3 "" H 7050 1250 50 0001 C CNN 1 7050 1250 0 1 1 0 $EndComp +Text GLabel 3000 6550 2 50 Input ~ 0 +SCK +Text GLabel 8650 4600 2 50 Output ~ 0 +SCK +Wire Wire Line + 7100 3000 7200 3000 +Wire Wire Line + 6600 2900 7200 2900 +Wire Wire Line + 6900 2200 7200 2200 +Wire Wire Line + 7600 1600 7700 1600 +Wire Wire Line + 8600 4600 8650 4600 +Text GLabel 8650 4500 2 50 Output ~ 0 +NCS +Wire Wire Line + 8600 4500 8650 4500 +Wire Wire Line + 2950 6550 3000 6550 +Wire Wire Line + 2950 6350 3400 6350 +Connection ~ 3400 6350 +Wire Wire Line + 3400 6350 3700 6350 +Wire Wire Line + 2950 6450 3000 6450 +Text GLabel 3700 6350 2 50 Output ~ 0 +MISO +Text Notes 5400 3750 0 50 ~ 0 +2*(Cload-Cstray)*2^(18-6)= \n24pF = 22pF +Text GLabel 3000 6450 2 50 Input ~ 0 +MOSI +Wire Wire Line + 9650 4450 9600 4450 +Wire Wire Line + 9300 4350 9650 4350 +Text GLabel 9600 4450 0 50 Output ~ 0 +SWCLK +$Comp +L power:+3.3V #PWR0104 +U 1 1 600A9E8A +P 9300 4350 +F 0 "#PWR0104" H 9300 4200 50 0001 C CNN +F 1 "+3.3V" H 9315 4523 50 0000 C CNN +F 2 "" H 9300 4350 50 0001 C CNN +F 3 "" H 9300 4350 50 0001 C CNN + 1 9300 4350 + 1 0 0 -1 +$EndComp +Text GLabel 3000 6250 2 50 Input ~ 0 +NCS +Wire Wire Line + 1450 6250 2050 6250 +Wire Wire Line + 2950 6250 3000 6250 +Text GLabel 7150 3600 0 50 Input ~ 0 +MISO +Text GLabel 7150 3700 0 50 Output ~ 0 +MOSI +Text GLabel 7150 3500 0 50 Input ~ 0 +Motion +Wire Wire Line + 7150 3500 7200 3500 +Wire Wire Line + 7150 3600 7200 3600 +Wire Wire Line + 7150 3700 7200 3700 +Wire Wire Line + 8600 2900 8650 2900 +Wire Wire Line + 8600 3000 8650 3000 $EndSCHEMATC