Skip to content

Commit 8d0892b

Browse files
smunautesden
authored andcommitted
icebitsy: Add dummy USB pads to prevent false detection by host
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
1 parent 55f7547 commit 8d0892b

File tree

11 files changed

+94
-8
lines changed

11 files changed

+94
-8
lines changed

icebitsy/blink_count_shift/blink_count_shift.v

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
/* Small test design actuating all IO on the iCEBreaker-bitsy dev board. */
22

33
module top (
4+
inout USB_P,
5+
inout USB_N,
6+
inout USB_DET,
7+
48
input CLK,
59

6-
input BTN_N,
10+
input BTN_N,
711

812
output LEDG_N,
913

@@ -19,6 +23,9 @@ module top (
1923
dfu_helper #(
2024
.BTN_MODE(3)
2125
) dfu_helper_I (
26+
.usb_dp (USB_P),
27+
.usb_dn (USB_N),
28+
.usb_pu (USB_DET),
2229
.boot_sel (2'b00),
2330
.boot_now (1'b0),
2431
.btn_in (BTN_N),

icebitsy/charlieplexing-tomk/pmodcharlie.v

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
`timescale 1ns / 1ps
22

33
module top(
4-
input CLK,
5-
input BTN_N,
4+
inout USB_P,
5+
inout USB_N,
6+
inout USB_DET,
7+
8+
input CLK,
9+
input BTN_N,
610
output LEDG_N,
711
output P1_1, P1_2, P1_3, P1_4, P1_7, P1_8, P1_9, P1_10
812
);
@@ -19,6 +23,9 @@ module top(
1923
dfu_helper #(
2024
.BTN_MODE(3)
2125
) dfu_helper_I (
26+
.usb_dp (USB_P),
27+
.usb_dn (USB_N),
28+
.usb_pu (USB_DET),
2229
.boot_sel (2'b00),
2330
.boot_now (1'b0),
2431
.btn_in (BTN_N),

icebitsy/common/dfu_helper.v

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@
3030
`default_nettype none
3131

3232
module dfu_helper #(
33+
parameter integer DUMMY_USB = 1, // Include dummy USB IOs to avoid false detection
3334
parameter integer SAMP_TW = 7, // Sample button every 128 cycles
3435
parameter integer LONG_TW = 17, // Consider long press after 2^19 sampling
3536
parameter integer BTN_MODE = 3, // [2] Use btn_tick, [1] Include IO buffer, [0] Invert (active-low)
3637
parameter integer BOOTLOADER_MODE = 0, // 0 = For user app, 1 = For bootloader
3738
parameter BOOT_IMAGE = 2'b01, // Bootloader image
3839
parameter USER_IMAGE = 2'b10 // User image
3940
)(
41+
// USB IOs
42+
inout wire usb_dp,
43+
inout wire usb_dn,
44+
inout wire usb_pu,
45+
4046
// External control
4147
input wire [1:0] boot_sel,
4248
input wire boot_now,
@@ -83,6 +89,21 @@ module dfu_helper #(
8389
reg wb_now;
8490

8591

92+
// Dummy USB
93+
// ---------
94+
95+
if (DUMMY_USB)
96+
SB_IO #(
97+
.PIN_TYPE (6'b10_1000),
98+
.PULLUP (1'b0),
99+
.IO_STANDARD ("SB_LVCMOS")
100+
) usb[2:0] (
101+
.PACKAGE_PIN ({usb_dp, usb_dn, usb_pu}),
102+
.OUTPUT_ENABLE (1'b0),
103+
.D_OUT_0 (1'b0)
104+
);
105+
106+
86107
// Button
87108
// ------
88109

icebitsy/dvi-12bit/dvi-12bit.v

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858

5959
module top
6060
(
61+
inout USB_P,
62+
inout USB_N,
63+
inout USB_DET,
64+
6165
input CLK,
6266
output LEDG_N, // on board green
6367
input BTN_N, // user button aka reset
@@ -92,6 +96,9 @@ dfu_helper #(
9296
.LONG_TW(19),
9397
.BTN_MODE(3)
9498
) dfu_helper_I (
99+
.usb_dp (USB_P),
100+
.usb_dn (USB_N),
101+
.usb_pu (USB_DET),
95102
.boot_sel (2'b00),
96103
.boot_now (1'b0),
97104
.btn_in (BTN_N),

icebitsy/dvi-24bit/dvi-24bit.v

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858

5959
module top
6060
(
61+
inout USB_P,
62+
inout USB_N,
63+
inout USB_DET,
64+
6165
input CLK,
6266
output LEDG_N, // on board green
6367
input BTN_N, // user button aka reset
@@ -93,6 +97,9 @@ dfu_helper #(
9397
.LONG_TW(19),
9498
.BTN_MODE(3)
9599
) dfu_helper_I (
100+
.usb_dp (USB_P),
101+
.usb_dn (USB_N),
102+
.usb_pu (USB_DET),
96103
.boot_sel (2'b00),
97104
.boot_now (1'b0),
98105
.btn_in (BTN_N),

icebitsy/dvi-4bit/dvi-4bit.v

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858

5959
module top
6060
(
61+
inout USB_P,
62+
inout USB_N,
63+
inout USB_DET,
64+
6165
input CLK,
6266
output LEDG_N, // on board green
6367
input BTN_N, // user button aka reset
@@ -93,6 +97,9 @@ dfu_helper #(
9397
.LONG_TW(19),
9498
.BTN_MODE(3)
9599
) dfu_helper_I (
100+
.usb_dp (USB_P),
101+
.usb_dn (USB_N),
102+
.usb_pu (USB_DET),
96103
.boot_sel (2'b00),
97104
.boot_now (1'b0),
98105
.btn_in (BTN_N),

icebitsy/pdm_fade/pdm.v

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
// brigtness up and down in opposite directions.
2929

3030
module top (
31+
inout USB_P,
32+
inout USB_N,
33+
inout USB_DET,
3134
input CLK,
3235
output LEDG_N,
3336
input BTN_N,
@@ -43,6 +46,9 @@ wire will_reboot;
4346
dfu_helper #(
4447
.BTN_MODE(3)
4548
) dfu_helper_I (
49+
.usb_dp (USB_P),
50+
.usb_dn (USB_N),
51+
.usb_pu (USB_DET),
4652
.boot_sel (2'b00),
4753
.boot_now (1'b0),
4854
.btn_in (BTN_N),
@@ -148,4 +154,4 @@ assign P3 = pdm_out; // PDM output on a GPIO pin
148154
assign P4 = pdm_inc_counter[15]; // 50% duty cycle PDM inc clock
149155
assign P5 = pdm_out; // PDM output on a GPIO pin
150156

151-
endmodule
157+
endmodule

icebitsy/pdm_fade_gamma/gamma_pdm.v

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
// brigtness up and down in opposite directions.
2929

3030
module top (
31+
inout USB_P,
32+
inout USB_N,
33+
inout USB_DET,
3134
input CLK,
3235
output LEDG_N,
3336
input BTN_N,
@@ -45,6 +48,9 @@ wire will_reboot;
4548
dfu_helper #(
4649
.BTN_MODE(3)
4750
) dfu_helper_I (
51+
.usb_dp (USB_P),
52+
.usb_dn (USB_N),
53+
.usb_pu (USB_DET),
4854
.boot_sel (2'b00),
4955
.boot_now (1'b0),
5056
.btn_in (BTN_N),
@@ -170,4 +176,4 @@ assign P5 = pdm_inc_counter[15]; // 50% duty cycle PDM inc clock
170176
assign P6 = pdm_out1; // PDM output on a GPIO pin
171177
assign P7 = pdm_out2; // PDM output on a GPIO pin
172178

173-
endmodule
179+
endmodule

icebitsy/pwm_fade/pwm.v

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
// "breathe" in brigtness up and down in opposite directions.
2424

2525
module top (
26+
inout USB_P,
27+
inout USB_N,
28+
inout USB_DET,
2629
input CLK,
2730
output LEDG_N,
2831
input BTN_N,
@@ -36,6 +39,9 @@ wire will_reboot;
3639
dfu_helper #(
3740
.BTN_MODE(3)
3841
) dfu_helper_I (
42+
.usb_dp (USB_P),
43+
.usb_dn (USB_N),
44+
.usb_pu (USB_DET),
3945
.boot_sel (2'b00),
4046
.boot_now (1'b0),
4147
.btn_in (BTN_N),
@@ -119,4 +125,4 @@ SB_RGBA_DRV #(
119125
assign P2 = pwm_counter[15]; // 50% duty cycle PWM clock out
120126
assign P3 = pwm_out; // PWM output on a GPIO pin
121127

122-
endmodule
128+
endmodule

icebitsy/pwm_fade_gamma/gamma_pwm.v

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
// https://en.wikipedia.org/wiki/Gamma_correction
2727

2828
module top (
29+
inout USB_P,
30+
inout USB_N,
31+
inout USB_DET,
2932
input CLK,
3033
output LEDG_N,
3134
input BTN_N,
@@ -40,6 +43,9 @@ wire will_reboot;
4043
dfu_helper #(
4144
.BTN_MODE(3)
4245
) dfu_helper_I (
46+
.usb_dp (USB_P),
47+
.usb_dn (USB_N),
48+
.usb_pu (USB_DET),
4349
.boot_sel (2'b00),
4450
.boot_now (1'b0),
4551
.btn_in (BTN_N),
@@ -133,4 +139,4 @@ assign P2 = pwm_counter[15];
133139
assign P3 = pwm_out_0;
134140
assign P4 = pwm_out_1;
135141

136-
endmodule
142+
endmodule

0 commit comments

Comments
 (0)