ソースを参照

RGB Controller 최종 소스 코드
수정 사항
SX1276.c : define 정의 선언
디버거 핀 추가
로라 환경 설정 값 제대로 안 주는 문제 수정
불필요한 Timer 제거

june9152 6 年 前
コミット
fd50e7263c

File diff suppressed because it is too large
+ 1 - 1
.mxproject


+ 1 - 1
.settings/language.settings.xml

@@ -4,7 +4,7 @@
4 4
 		<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
5 5
 			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
6 6
 			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
7
-			<provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="157605811251204298" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
7
+			<provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="1421905487508415165" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
8 8
 				<language-scope id="org.eclipse.cdt.core.gcc"/>
9 9
 				<language-scope id="org.eclipse.cdt.core.g++"/>
10 10
 			</provider>

BIN
Debug/STM32F103_RGB_Controller.bin


BIN
Debug/STM32F103_RGB_Controller.binary


BIN
Debug/STM32F103_RGB_Controller.elf


File diff suppressed because it is too large
+ 836 - 846
Debug/STM32F103_RGB_Controller.hex


File diff suppressed because it is too large
+ 3449 - 3443
Debug/STM32F103_RGB_Controller.list


File diff suppressed because it is too large
+ 419 - 418
Debug/STM32F103_RGB_Controller.map


BIN
Debug/Src/RGB_Controller.o


BIN
Debug/Src/main.o


+ 25 - 25
Debug/Src/main.su

@@ -1,25 +1,25 @@
1
-main.c:161:6:HAL_UART_RxCpltCallback	8	static
2
-main.c:174:6:HAL_TIM_PeriodElapsedCallback	0	static
3
-main.c:185:6:LoraDataSendSet	0	static
4
-main.c:188:9:LoraDataSendGet	0	static
5
-main.c:192:6:UartDataRecvSet	0	static
6
-main.c:195:9:UartDataRecvGet	0	static
7
-main.c:198:6:RGB_SensorIDAutoSet	0	static
8
-main.c:201:9:RGB_SensorIDAutoGet	0	static
9
-main.c:205:6:Uart2_Data_Send	0	static
10
-main.c:208:6:Uart1_Data_Send	0	static
11
-main.c:212:5:_write	8	static
12
-main.c:248:6:Uart_dataCheck	24	static
13
-main.c:280:6:RGB_Sensor_PowerOnOff	16	static
14
-main.c:437:6:test_read	24	static
15
-main.c:456:6:Flash_RGB_Data_Write	16	static
16
-main.c:469:6:Flash_write	24	static
17
-main.c:522:6:Flash_InitRead	12	static
18
-main.c:556:6:Lora_Initialize	32	static
19
-main.c:581:6:Lora_Operate	24	static
20
-main.c:611:6:Usart_Data_RecvCheck	16	static
21
-main.c:643:6:RGB_Sensor_DataRequest	48	static
22
-main.c:669:6:WDOG_Check_Flag	0	static
23
-main.c:767:6:SystemClock_Config	72	static
24
-main.c:683:5:main	64	static
25
-main.c:1095:6:Error_Handler	0	static
1
+main.c:160:6:HAL_UART_RxCpltCallback	8	static
2
+main.c:173:6:HAL_TIM_PeriodElapsedCallback	0	static
3
+main.c:184:6:LoraDataSendSet	0	static
4
+main.c:187:9:LoraDataSendGet	0	static
5
+main.c:191:6:UartDataRecvSet	0	static
6
+main.c:194:9:UartDataRecvGet	0	static
7
+main.c:197:6:RGB_SensorIDAutoSet	0	static
8
+main.c:200:9:RGB_SensorIDAutoGet	0	static
9
+main.c:204:6:Uart2_Data_Send	0	static
10
+main.c:207:6:Uart1_Data_Send	0	static
11
+main.c:211:5:_write	8	static
12
+main.c:247:6:Uart_dataCheck	24	static
13
+main.c:279:6:RGB_Sensor_PowerOnOff	16	static
14
+main.c:436:6:test_read	24	static
15
+main.c:455:6:Flash_RGB_Data_Write	16	static
16
+main.c:468:6:Flash_write	24	static
17
+main.c:521:6:Flash_InitRead	12	static
18
+main.c:555:6:Lora_Initialize	32	static
19
+main.c:580:6:Lora_Operate	24	static
20
+main.c:613:6:Usart_Data_RecvCheck	16	static
21
+main.c:645:6:RGB_Sensor_DataRequest	48	static
22
+main.c:671:6:WDOG_Check_Flag	0	static
23
+main.c:770:6:SystemClock_Config	72	static
24
+main.c:685:5:main	64	static
25
+main.c:1098:6:Error_Handler	0	static

BIN
Debug/Src/stm32f1xx_hal_msp.o


+ 5 - 8
STM32F103_RGBController.ioc

@@ -73,15 +73,14 @@ Mcu.Pin38=PB8
73 73
 Mcu.Pin39=PB9
74 74
 Mcu.Pin4=PA2
75 75
 Mcu.Pin40=VP_IWDG_VS_IWDG
76
-Mcu.Pin41=VP_SYS_VS_ND
77
-Mcu.Pin42=VP_SYS_VS_Systick
78
-Mcu.Pin43=VP_TIM6_VS_ClockSourceINT
76
+Mcu.Pin41=VP_SYS_VS_Systick
77
+Mcu.Pin42=VP_TIM6_VS_ClockSourceINT
79 78
 Mcu.Pin5=PA3
80 79
 Mcu.Pin6=PA4
81 80
 Mcu.Pin7=PA5
82 81
 Mcu.Pin8=PA6
83 82
 Mcu.Pin9=PA7
84
-Mcu.PinsNb=44
83
+Mcu.PinsNb=43
85 84
 Mcu.ThirdPartyNb=0
86 85
 Mcu.UserConstants=
87 86
 Mcu.UserName=STM32F103RCTx
@@ -105,9 +104,9 @@ NVIC.USART2_IRQn=true\:0\:0\:false\:true\:true\:3\:true
105 104
 NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false
106 105
 PA10.Mode=Asynchronous
107 106
 PA10.Signal=USART1_RX
108
-PA13.Locked=true
107
+PA13.Mode=Serial_Wire
109 108
 PA13.Signal=SYS_JTMS-SWDIO
110
-PA14.Locked=true
109
+PA14.Mode=Serial_Wire
111 110
 PA14.Signal=SYS_JTCK-SWCLK
112 111
 PA15.GPIOParameters=GPIO_Label
113 112
 PA15.GPIO_Label=SX1276_NSS
@@ -315,8 +314,6 @@ USART2.IPParameters=VirtualMode
315 314
 USART2.VirtualMode=VM_ASYNC
316 315
 VP_IWDG_VS_IWDG.Mode=IWDG_Activate
317 316
 VP_IWDG_VS_IWDG.Signal=IWDG_VS_IWDG
318
-VP_SYS_VS_ND.Mode=No_Debug
319
-VP_SYS_VS_ND.Signal=SYS_VS_ND
320 317
 VP_SYS_VS_Systick.Mode=SysTick
321 318
 VP_SYS_VS_Systick.Signal=SYS_VS_Systick
322 319
 VP_TIM6_VS_ClockSourceINT.Mode=Enable_Timer

+ 13 - 0
STM32F103_RGB_Controller.elf.launch

@@ -1,5 +1,17 @@
1 1
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 2
 <launchConfiguration type="com.atollic.hardwaredebug.launch.launchConfigurationType">
3
+<stringAttribute key="com.atollic.hardwaredebug.jlink_common.cpu_core" value="Cortex-M"/>
4
+<stringAttribute key="com.atollic.hardwaredebug.jlink_common.device" value="STM32F103RC"/>
5
+<stringAttribute key="com.atollic.hardwaredebug.jlink_common.endian" value="little"/>
6
+<stringAttribute key="com.atollic.hardwaredebug.jlink_common.init_speed" value="4000"/>
7
+<booleanAttribute key="com.atollic.hardwaredebug.jlink_common.jlink_check_serial_number" value="false"/>
8
+<stringAttribute key="com.atollic.hardwaredebug.jlink_common.jlink_script_path" value=""/>
9
+<booleanAttribute key="com.atollic.hardwaredebug.jlink_common.jlink_script_used" value="false"/>
10
+<stringAttribute key="com.atollic.hardwaredebug.jlink_common.jlink_txt_serial_number" value=""/>
11
+<booleanAttribute key="com.atollic.hardwaredebug.jlink_common.scan_chain_auto" value="true"/>
12
+<intAttribute key="com.atollic.hardwaredebug.jlink_common.scan_chain_irpre" value="0"/>
13
+<intAttribute key="com.atollic.hardwaredebug.jlink_common.scan_chain_pos" value="0"/>
14
+<stringAttribute key="com.atollic.hardwaredebug.jlink_common.selected_rtos" value="No RTOS"/>
3 15
 <intAttribute key="com.atollic.hardwaredebug.launch.formatVersion" value="2"/>
4 16
 <stringAttribute key="com.atollic.hardwaredebug.launch.hwinitCommands" value="# Initialize your hardware here&#10;"/>
5 17
 <stringAttribute key="com.atollic.hardwaredebug.launch.initCommands" value=""/>
@@ -37,5 +49,6 @@
37 49
 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
38 50
 <listEntry value="4"/>
39 51
 </listAttribute>
52
+<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#13;&#10;"/>
40 53
 <stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
41 54
 </launchConfiguration>

+ 1 - 1
Src/RGB_Controller.c

@@ -518,7 +518,7 @@ void RGB_Controller_Func(uint8_t* data){
518 518
             break;
519 519
         case RGB_Lora_ConfigGet:
520 520
             Result_buf[bluecell_stx]         = 0xbe;
521
-            Result_buf[bluecell_type]        = RGB_ControllerLimitGet;
521
+            Result_buf[bluecell_type]        = RGB_Lora_ConfigGet;
522 522
             Result_buf[bluecell_length]      = 7;
523 523
             Result_buf[bluecell_srcid + 0]   = SX1276.frequency;
524 524
             Result_buf[bluecell_srcid + 1]   = SX1276.LoRa_Pa_boost;            

+ 1 - 1
Src/SX1276.c

@@ -463,7 +463,7 @@ uint8_t SX1276_RSSI_LoRa(SX1276_t * module) {
463 463
 
464 464
 uint8_t SX1276_RSSI(SX1276_t * module) {
465 465
 	uint8_t temp = 0xff;
466
-	temp = SX1276_SPIRead(module, 0x11);
466
+	temp = SX1276_SPIRead(module, RegRssiValue);
467 467
 	temp = 127 - (temp >> 1);	//127:Max RSSI
468 468
 	return temp;
469 469
 }

+ 10 - 7
Src/main.c

@@ -93,7 +93,7 @@ volatile uint32_t Uart1TimerCnt = 0;
93 93
 volatile uint32_t Uart2TimerCnt = 0;
94 94
 
95 95
 volatile uint32_t LedTimerCnt = 0;
96
-volatile uint32_t LoraTxTimerCnt = 0;
96
+//volatile uint32_t LoraTxTimerCnt = 0;
97 97
 volatile uint32_t LoraAckTimerCnt = 0;
98 98
 
99 99
 
@@ -102,7 +102,6 @@ uint8_t buf[buf_size] = {0,};
102 102
 uint8_t buf1[buf_size] = {0,};
103 103
 uint8_t buf2[buf_size] = {0,};
104 104
 
105
-//Default_SX1276_t Default_SX1276;
106 105
 Default_SX1276_t Default_SX1276 = 
107 106
 {
108 107
     SX1276_917MHZ,
@@ -178,7 +177,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
178 177
         Uart1TimerCnt++;
179 178
         Uart2TimerCnt++;
180 179
         LedTimerCnt++;
181
-        LoraTxTimerCnt++;
180
+//        LoraTxTimerCnt++;
182 181
         LoraAckTimerCnt++;
183 182
     }
184 183
 }
@@ -579,6 +578,7 @@ void Lora_Initialize(void){
579 578
     }
580 579
 }
581 580
 void Lora_Operate(void){
581
+    uint8_t temp_rssi = 0;
582 582
     if(RGB_SensorIDAutoGet() == 0){/*ID allocate if sentence Condition */
583 583
         if(LoraDataSendGet() == LoraTx_mode && Lora_Buf[0] == 0xbe){
584 584
             //        LoraDataSendSet(LoraRx_mode);
@@ -596,6 +596,8 @@ void Lora_Operate(void){
596 596
             ret = SX1276_LoRaRxPacket(&SX1276);
597 597
             if (ret > 0) {
598 598
                 SX1276_read(&SX1276, &buffer[0], ret);
599
+                temp_rssi = SX1276_RSSI_LoRa(&SX1276);
600
+                printf("Rssi : %d \n",temp_rssi);
599 601
 //                printf("Received Data : ");
600 602
 //                for(uint8_t i = 0; i < ret; i++)
601 603
 //                printf("%02x ",  buffer[i]);
@@ -741,14 +743,15 @@ int main(void)
741 743
   RGB_Data_Init();
742 744
   Lora_Initialize();
743 745
   /* USER CODE END 2 */
746
+
744 747
   /* Infinite loop */
745 748
   /* USER CODE BEGIN WHILE */
746 749
   while (1)
747 750
   {
748
-     if(LoraTxTimerCnt > LORA_TIMER_CNT){
749
-        LoraTxTimerCnt = 0;
750
-//        LoraDataSendSet(1);
751
-    }
751
+//     if(LoraTxTimerCnt > LORA_TIMER_CNT){
752
+//        LoraTxTimerCnt = 0;
753
+////        LoraDataSendSet(1);
754
+//    }
752 755
     RGB_Alarm_Operate();//LED ALARM CHECK
753 756
     Lora_Operate();
754 757
     Usart_Data_RecvCheck();

+ 2 - 2
Src/stm32f1xx_hal_msp.c

@@ -95,9 +95,9 @@ void HAL_MspInit(void)
95 95
 
96 96
   /* System interrupt init*/
97 97
 
98
-  /**DISABLE: JTAG-DP Disabled and SW-DP Disabled 
98
+  /**NOJTAG: JTAG-DP Disabled and SW-DP Enabled 
99 99
   */
100
-  __HAL_AFIO_REMAP_SWJ_DISABLE();
100
+  __HAL_AFIO_REMAP_SWJ_NOJTAG();
101 101
 
102 102
   /* USER CODE BEGIN MspInit 1 */
103 103