diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..74aa05c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "files.encoding": "gbk" +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f9ce20f --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +引脚分配参考: +https://iflytop1.feishu.cn/docx/SqzLdKLmxoAtMLxLEYec2sIcn4g \ No newline at end of file diff --git a/light_src_ctrl_fpga_port.jic b/light_src_ctrl_fpga_port.jic new file mode 100644 index 0000000..b1f5a75 Binary files /dev/null and b/light_src_ctrl_fpga_port.jic differ diff --git a/light_src_ctrl_fpga_port.map b/light_src_ctrl_fpga_port.map new file mode 100644 index 0000000..d5393c9 --- /dev/null +++ b/light_src_ctrl_fpga_port.map @@ -0,0 +1,11 @@ +BLOCK START ADDRESS END ADDRESS + +Page_0 0x00000000 0x00059D8A + + + +Notes: + +- Data checksum for this conversion is 0x1A5DC668 + +- All the addresses in this file are byte addresses \ No newline at end of file diff --git a/run_led.cdf b/run_led.cdf index 52d3ec3..d54f043 100644 --- a/run_led.cdf +++ b/run_led.cdf @@ -4,7 +4,7 @@ JedecChain; DefaultMfr(6E); P ActionCode(Cfg) - Device PartName(EP4CE6E22) Path("C:/Users/h_zha/Downloads/Heijin/LTC4CH_FPGA/") File("run_led.sof") MfrSpec(OpMask(1)); + Device PartName(EP4CE6E22) Path("D:/workspace/p_light_src_ctrl_20240218/light_src_ctrl_fpga_port/") File("run_led.sof") MfrSpec(OpMask(1)); ChainEnd; diff --git a/run_led.jdi b/run_led.jdi index 6862416..7ccc0ab 100644 --- a/run_led.jdi +++ b/run_led.jdi @@ -1,6 +1,6 @@ - + diff --git a/run_led.pin b/run_led.pin index a51ecdb..6f049a7 100644 --- a/run_led.pin +++ b/run_led.pin @@ -95,7 +95,7 @@ GND+ : 24 : : : GND+ : 25 : : : : 2 : VCCIO2 : 26 : power : : 3.3V : 2 : GND : 27 : gnd : : : : -RESERVED_INPUT : 28 : : : : 2 : +trigger_input0 : 28 : input : 3.3-V LVTTL : : 2 : Y VCCINT : 29 : power : : 1.2V : : RESERVED_INPUT : 30 : : : : 2 : RESERVED_INPUT : 31 : : : : 2 : @@ -117,26 +117,26 @@ RESERVED_INPUT : 46 : : : VCCIO3 : 47 : power : : 3.3V : 3 : GND : 48 : gnd : : : : RESERVED_INPUT : 49 : : : : 3 : -RESERVED_INPUT : 50 : : : : 3 : -RESERVED_INPUT : 51 : : : : 3 : +lt_on_off_ctrl_1 : 50 : output : 3.3-V LVTTL : : 3 : Y +lt_on_off_ctrl_2 : 51 : output : 3.3-V LVTTL : : 3 : Y RESERVED_INPUT : 52 : : : : 3 : RESERVED_INPUT : 53 : : : : 3 : RESERVED_INPUT : 54 : : : : 4 : RESERVED_INPUT : 55 : : : : 4 : VCCIO4 : 56 : power : : 3.3V : 4 : GND : 57 : gnd : : : : -RESERVED_INPUT : 58 : : : : 4 : +lt_intensity_1 : 58 : output : 3.3-V LVTTL : : 4 : Y RESERVED_INPUT : 59 : : : : 4 : -RESERVED_INPUT : 60 : : : : 4 : +lt_intensity_2 : 60 : output : 3.3-V LVTTL : : 4 : Y VCCINT : 61 : power : : 1.2V : : VCCIO4 : 62 : power : : 3.3V : 4 : GND : 63 : gnd : : : : -RESERVED_INPUT : 64 : : : : 4 : -RESERVED_INPUT : 65 : : : : 4 : +lt_intensity_3 : 64 : output : 3.3-V LVTTL : : 4 : Y +lt_on_off_ctrl_3 : 65 : output : 3.3-V LVTTL : : 4 : Y RESERVED_INPUT : 66 : : : : 4 : RESERVED_INPUT : 67 : : : : 4 : -RESERVED_INPUT : 68 : : : : 4 : -RESERVED_INPUT : 69 : : : : 4 : +lt_intensity_4 : 68 : output : 3.3-V LVTTL : : 4 : Y +lt_on_off_ctrl_4 : 69 : output : 3.3-V LVTTL : : 4 : Y RESERVED_INPUT : 70 : : : : 4 : RESERVED_INPUT : 71 : : : : 4 : RESERVED_INPUT : 72 : : : : 4 : @@ -170,19 +170,19 @@ RESERVED_INPUT : 99 : : : RESERVED_INPUT : 100 : : : : 6 : ~ALTERA_nCEO~ / RESERVED_OUTPUT_OPEN_DRAIN : 101 : output : 3.3-V LVTTL : : 6 : N VCCINT : 102 : power : : 1.2V : : -RESERVED_INPUT : 103 : : : : 6 : -RESERVED_INPUT : 104 : : : : 6 : -RESERVED_INPUT : 105 : : : : 6 : -RESERVED_INPUT : 106 : : : : 6 : +stm32_pc9 : 103 : input : 3.3-V LVTTL : : 6 : Y +stm32_pc8 : 104 : input : 3.3-V LVTTL : : 6 : Y +stm32_pc7 : 105 : input : 3.3-V LVTTL : : 6 : Y +stm32_pc6 : 106 : input : 3.3-V LVTTL : : 6 : Y VCCA2 : 107 : power : : 2.5V : : GNDA2 : 108 : gnd : : : : VCCD_PLL2 : 109 : power : : 1.2V : : -RESERVED_INPUT : 110 : : : : 7 : +camera_shutter_out : 110 : output : 3.3-V LVTTL : : 7 : N RESERVED_INPUT : 111 : : : : 7 : RESERVED_INPUT : 112 : : : : 7 : RESERVED_INPUT : 113 : : : : 7 : -RESERVED_INPUT : 114 : : : : 7 : -RESERVED_INPUT : 115 : : : : 7 : +stm32_pa5 : 114 : input : 3.3-V LVTTL : : 7 : Y +stm32_pa4 : 115 : input : 3.3-V LVTTL : : 7 : Y VCCINT : 116 : power : : 1.2V : : VCCIO7 : 117 : power : : 3.3V : 7 : GND : 118 : gnd : : : : @@ -193,7 +193,7 @@ VCCIO7 : 122 : power : : 3.3V GND : 123 : gnd : : : : RESERVED_INPUT : 124 : : : : 7 : RESERVED_INPUT : 125 : : : : 7 : -RESERVED_INPUT : 126 : : : : 7 : +tp5 : 126 : output : 3.3-V LVTTL : : 7 : N RESERVED_INPUT : 127 : : : : 7 : RESERVED_INPUT : 128 : : : : 8 : RESERVED_INPUT : 129 : : : : 8 : @@ -202,14 +202,14 @@ GND : 131 : gnd : : RESERVED_INPUT : 132 : : : : 8 : RESERVED_INPUT : 133 : : : : 8 : VCCINT : 134 : power : : 1.2V : : -RESERVED_INPUT : 135 : : : : 8 : -RESERVED_INPUT : 136 : : : : 8 : -RESERVED_INPUT : 137 : : : : 8 : +tp6 : 135 : output : 3.3-V LVTTL : : 8 : Y +tp7 : 136 : output : 3.3-V LVTTL : : 8 : Y +tp8 : 137 : output : 3.3-V LVTTL : : 8 : Y RESERVED_INPUT : 138 : : : : 8 : VCCIO8 : 139 : power : : 3.3V : 8 : GND : 140 : gnd : : : : -RESERVED_INPUT : 141 : : : : 8 : -RESERVED_INPUT : 142 : : : : 8 : -RESERVED_INPUT : 143 : : : : 8 : -RESERVED_INPUT : 144 : : : : 8 : +stm32_pa3 : 141 : input : 3.3-V LVTTL : : 8 : Y +stm32_pa2 : 142 : input : 3.3-V LVTTL : : 8 : Y +stm32_pa1 : 143 : input : 3.3-V LVTTL : : 8 : Y +stm32_pa0 : 144 : output : 3.3-V LVTTL : : 8 : Y GND : EPAD : : : : : diff --git a/run_led.pof b/run_led.pof index db234d0..2bf8f9f 100644 Binary files a/run_led.pof and b/run_led.pof differ diff --git a/run_led.qsf b/run_led.qsf index 994acda..0b04ac7 100644 --- a/run_led.qsf +++ b/run_led.qsf @@ -68,4 +68,26 @@ set_location_assignment PIN_10 -to debug_light[1] set_location_assignment PIN_33 -to debug_light[0] set_location_assignment PIN_23 -to clk set_global_assignment -name DEVICE_FILTER_SPEED_GRADE 8 +set_location_assignment PIN_58 -to lt_intensity_1 +set_location_assignment PIN_60 -to lt_intensity_2 +set_location_assignment PIN_64 -to lt_intensity_3 +set_location_assignment PIN_68 -to lt_intensity_4 +set_location_assignment PIN_50 -to lt_on_off_ctrl_1 +set_location_assignment PIN_51 -to lt_on_off_ctrl_2 +set_location_assignment PIN_65 -to lt_on_off_ctrl_3 +set_location_assignment PIN_69 -to lt_on_off_ctrl_4 +set_location_assignment PIN_144 -to stm32_pa0 +set_location_assignment PIN_143 -to stm32_pa1 +set_location_assignment PIN_142 -to stm32_pa2 +set_location_assignment PIN_141 -to stm32_pa3 +set_location_assignment PIN_115 -to stm32_pa4 +set_location_assignment PIN_114 -to stm32_pa5 +set_location_assignment PIN_106 -to stm32_pc6 +set_location_assignment PIN_105 -to stm32_pc7 +set_location_assignment PIN_104 -to stm32_pc8 +set_location_assignment PIN_103 -to stm32_pc9 +set_location_assignment PIN_28 -to trigger_input0 +set_location_assignment PIN_135 -to tp6 +set_location_assignment PIN_136 -to tp7 +set_location_assignment PIN_137 -to tp8 set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top \ No newline at end of file diff --git a/run_led.sof b/run_led.sof index 559f38e..0eddfef 100644 Binary files a/run_led.sof and b/run_led.sof differ diff --git a/source/led0_module.v b/source/led0_module.v deleted file mode 100644 index db1af3a..0000000 --- a/source/led0_module.v +++ /dev/null @@ -1,45 +0,0 @@ -module led0_module -( - CLK, RSTn, LED_Out -); - - input CLK; - input RSTn; - output LED_Out; - - /*************************************/ - - parameter T100MS = 23'd5_000_000;//DB4CE15开发板使用的晶振为50MHz,50M*0.01=5_000_000 - - /*************************************/ - - reg [22:0]Count1; - - always @ ( posedge CLK or negedge RSTn ) - if( !RSTn ) - Count1 <= 23'd0; - else if( Count1 == T100MS ) - Count1 <= 23'd0; - else - Count1 <= Count1 + 1'b1; - - /*************************************/ - - reg rLED_Out; - - always @ ( posedge CLK or negedge RSTn ) - if( !RSTn ) - rLED_Out <= 1'b0; - else if( Count1 >= 23'd0 && Count1 < 23'd1_250_000 )//100ms的第一个四分之一,具体请看教程11页的图2.1C - rLED_Out <= 1'b1; - else - rLED_Out <= 1'b0; - - /***************************************/ - - assign LED_Out = rLED_Out; - - /***************************************/ - - -endmodule diff --git a/source/led1_module.v b/source/led1_module.v deleted file mode 100644 index c3565c9..0000000 --- a/source/led1_module.v +++ /dev/null @@ -1,45 +0,0 @@ -module led1_module -( - CLK, RSTn, LED_Out -); - - input CLK; - input RSTn; - output LED_Out; - - /*************************************/ - - parameter T100MS = 23'd5_000_000;//DB4CE15开发板使用的晶振为50MHz,50M*0.01=5_000_000 - - /*************************************/ - - reg [22:0]Count1; - - always @ ( posedge CLK or negedge RSTn ) - if( !RSTn ) - Count1 <= 23'd0; - else if( Count1 == T100MS ) - Count1 <= 23'd0; - else - Count1 <= Count1 + 1'b1; - - /*************************************/ - - reg rLED_Out; - - always @ ( posedge CLK or negedge RSTn ) - if( !RSTn ) - rLED_Out <= 1'b0; - else if( Count1 >= 23'd1_250_000 && Count1 < 23'd2_500_000 )//100ms的第二个四分之一,具体请看教程11页的图2.1C - rLED_Out <= 1'b1; - else - rLED_Out <= 1'b0; - - /***************************************/ - - assign LED_Out = rLED_Out; - - /***************************************/ - - -endmodule diff --git a/source/led2_module.v b/source/led2_module.v deleted file mode 100644 index c57c9c6..0000000 --- a/source/led2_module.v +++ /dev/null @@ -1,45 +0,0 @@ -module led2_module -( - CLK, RSTn, LED_Out -); - - input CLK; - input RSTn; - output LED_Out; - - /*************************************/ - - parameter T100MS = 23'd5_000_000;//DB4CE15开发板使用的晶振为50MHz,50M*0.01=5_000_000 - - /*************************************/ - - reg [22:0]Count1; - - always @ ( posedge CLK or negedge RSTn ) - if( !RSTn ) - Count1 <= 23'd0; - else if( Count1 == T100MS ) - Count1 <= 23'd0; - else - Count1 <= Count1 + 1'b1; - - /*************************************/ - - reg rLED_Out; - - always @ ( posedge CLK or negedge RSTn ) - if( !RSTn ) - rLED_Out <= 1'b0; - else if( Count1 >= 23'd2_500_000 && Count1 < 23'd3_750_000 )//100ms的第三个四分之一,具体请看教程11页的图2.1C - rLED_Out <= 1'b1; - else - rLED_Out <= 1'b0; - - /***************************************/ - - assign LED_Out = rLED_Out; - - /***************************************/ - - -endmodule diff --git a/source/led3_module.v b/source/led3_module.v deleted file mode 100644 index 3a5db5d..0000000 --- a/source/led3_module.v +++ /dev/null @@ -1,45 +0,0 @@ -module led3_module -( - CLK, RSTn, LED_Out -); - - input CLK; - input RSTn; - output LED_Out; - - /*************************************/ - - parameter T100MS = 23'd5_000_000;//DB4CE15开发板使用的晶振为50MHz,50M*0.01=5_000_000 - - /*************************************/ - - reg [22:0]Count1; - - always @ ( posedge CLK or negedge RSTn ) - if( !RSTn ) - Count1 <= 23'd0; - else if( Count1 == T100MS ) - Count1 <= 23'd0; - else - Count1 <= Count1 + 1'b1; - - /*************************************/ - - reg rLED_Out; - - always @ ( posedge CLK or negedge RSTn ) - if( !RSTn ) - rLED_Out <= 1'b0; - else if( Count1 >= 23'd3_750_000 && Count1 < 23'd5_000_000 )//100ms的第四个四分之一,具体请看教程11页的图2.1C - rLED_Out <= 1'b1; - else - rLED_Out <= 1'b0; - - /***************************************/ - - assign LED_Out = rLED_Out; - - /***************************************/ - - -endmodule diff --git a/source/top_module.v b/source/top_module.v index bdfd133..b7a4b65 100644 --- a/source/top_module.v +++ b/source/top_module.v @@ -1,16 +1,69 @@ + module top_module ( - clk, - + input clk, + + //input_from_stm32 + input stm32_pc6, // 灯光强度控制PWM + input stm32_pc7, // 灯光强度控制PWM + input stm32_pc8, // 灯光强度控制PWM + input stm32_pc9, // 灯光强度控制PWM + + input stm32_pa1, // 快门控制 + input stm32_pa2, // 快门控制 + input stm32_pa3, // 快门控制 + input stm32_pa4, // 快门控制 + input stm32_pa5, // 快门控制 + + //output_to_stm32 + output stm32_pa0, // 输入捕获 + + //光强控制引脚 + output lt_intensity_1, //灯光强度控制输出 + output lt_intensity_2, //灯光强度控制输出 + output lt_intensity_3, //灯光强度控制输出 + output lt_intensity_4, //灯光强度控制输出 + + //拍照控制引脚 + output lt_on_off_ctrl_1, //指示灯通断控制输出 + output lt_on_off_ctrl_2, //指示灯通断控制输出 + output lt_on_off_ctrl_3, //指示灯通断控制输出 + output lt_on_off_ctrl_4, //指示灯通断控制输出 + + output camera_shutter_out, //相机快门控制输出 - debug_light + + // 触发输入引脚 + input trigger_input0, //触发输入 + + + //测试引脚 + // output spi2_miso, //用于测试的SPI输出 + + output tp5, + output tp6, + output tp7, + output tp8, + + output [2:0] debug_light ); - input clk; + assign lt_intensity_1 = stm32_pc6; + assign lt_intensity_2 = stm32_pc7; + assign lt_intensity_3 = stm32_pc8; + assign lt_intensity_4 = stm32_pc9; + + assign lt_on_off_ctrl_1 = stm32_pa1; + assign lt_on_off_ctrl_2 = stm32_pa2; + assign lt_on_off_ctrl_3 = stm32_pa3; + assign lt_on_off_ctrl_4 = stm32_pa4; + assign camera_shutter_out = stm32_pa5; - output [2:0] debug_light; + assign stm32_pa0 = !trigger_input0; - assign debug_light[0] = 0; - assign debug_light[1] = 1; + assign debug_light[0] = 1; + assign debug_light[1] = 0; assign debug_light[2] = 0; + assign tp8 = !trigger_input0; + endmodule diff --git a/source/top_module.v.bak b/source/top_module.v.bak deleted file mode 100644 index 685f75a..0000000 --- a/source/top_module.v.bak +++ /dev/null @@ -1,60 +0,0 @@ -module top_module -( - CLK, RSTn, LED_Out -); - - input CLK; - input RSTn; - output [3:0]LED_Out; - - /*******************************/ - - wire LED0_Out; - - led0_module U1 - ( - .CLK( CLK ), - .RSTn( RSTn ), - .LED_Out( LED0_Out ) - ); - - /*********************************/ - - wire LED1_Out; - - led1_module U2 - ( - .CLK( CLK ), - .RSTn( RSTn ), - .LED_Out( LED1_Out ) - ); - - /*********************************/ - - wire LED2_Out; - - led2_module U3 - ( - .CLK( CLK ), - .RSTn( RSTn ), - .LED_Out( LED2_Out ) - ); - - /*********************************/ - - wire LED3_Out; - - led3_module U4 - ( - .CLK( CLK ), - .RSTn( RSTn ), - .LED_Out( LED3_Out ) - ); - - /**********************************/ - - assign LED_Out = { LED3_Out, LED2_Out, LED1_Out, LED0_Out}; - - /***********************************/ - -endmodule diff --git a/source/top_module_bak2.v b/source/top_module_bak2.v deleted file mode 100644 index f3defdc..0000000 --- a/source/top_module_bak2.v +++ /dev/null @@ -1,70 +0,0 @@ -module top_module -( - //CLK, - //RSTn, - PC6, - PC7, - PC8, - PA9, - LT_PWM1, - LT_PWM2, - LT_PWM3, - LT_PWM4, - EXIN1, - EXIN1_to_MCU, - PA1, - PA2, - PA3, - PA4, - LT_EN1, - LT_EN2, - LT_EN3, - LT_EN4, - cam_triger -); - - //input CLK; - //input RSTn; - input PC6; - input PC7; - input PC8; - input PA9; - output LT_PWM1; - output LT_PWM2; - output LT_PWM3; - output LT_PWM4; - input EXIN1; - output EXIN1_to_MCU; - input PA1; - input PA2; - input PA3; - input PA4; - output LT_EN1; - output LT_EN2; - output LT_EN3; - output LT_EN4; - output cam_triger; - - /********鍏夋簮浜害鎺у埗***************/ - - assign LT_PWM1 = PC6; - assign LT_PWM2 = PC7; - assign LT_PWM3 = PC8; - assign LT_PWM4 = PA9; - /**********************************/ - - /********鍏夋簮浣胯兘*******************/ - assign LT_EN1 = PA1; - assign LT_EN2 = PA2; - assign LT_EN3 = PA3; - assign LT_EN4 = PA4; - - /**********************************/ - - assign EXIN1_to_MCU = EXIN1; - - /***********************************/ - - assign cam_triger = PA1 || PA2 || PA3 || PA4; - -endmodule