Skip to content

Commit

Permalink
Merge pull request #16 from mossmann/sideband
Browse files Browse the repository at this point in the history
Hold Sideband PHY RESET low on older Cynthions
  • Loading branch information
mossmann authored May 16, 2024
2 parents ae0bfb8 + a8e89ca commit 1248588
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
10 changes: 9 additions & 1 deletion boards/cynthion/board.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2023 Great Scott Gadgets <[email protected]>
// Copyright 2019-2024 Great Scott Gadgets <[email protected]>
// Copyright 2019 Katherine J. Temkin <[email protected]>
// Copyright 2014 Technical Machine, Inc. See the COPYRIGHT
// file at the top-level directory of this distribution.
Expand Down Expand Up @@ -35,4 +35,12 @@ const static Pin LED_PIN = {.group = 0, .pin = 22, .mux = 0 };
const static Pin PIN_USB_DM = {.group = 0, .pin = 24, .mux = MUX_PA24G_USB_DM };
const static Pin PIN_USB_DP = {.group = 0, .pin = 25, .mux = MUX_PA25G_USB_DP };

// Sideband PHY RESET
#if ((_BOARD_REVISION_MAJOR_ == 0) && (_BOARD_REVISION_MINOR_ < 3))
const static Pin SIDEBAND_RESET = {.group = 1, .pin = 23, .mux = 0 };
#elif ((_BOARD_REVISION_MAJOR_ == 0) && (_BOARD_REVISION_MINOR_ < 6))
const static Pin SIDEBAND_RESET = {.group = 0, .pin = 9, .mux = 0 };
#endif


#endif
18 changes: 14 additions & 4 deletions main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2023 Great Scott Gadgets <[email protected]>
// Copyright 2019-2024 Great Scott Gadgets <[email protected]>
// Copyright 2019 Katherine J. Temkin <[email protected]>
// Copyright 2014 Technical Machine, Inc. See the COPYRIGHT
// file at the top-level directory of this distribution.
Expand Down Expand Up @@ -66,16 +66,26 @@ void noopFunction(void)
void bootloader_main(void)
{

#if ((_BOARD_REVISION_MAJOR_ == 0) && (_BOARD_REVISION_MINOR_ < 6))
// Set up the LED that indicates we're in bootloader mode.
// Set up output pins.
#if ((_BOARD_REVISION_MAJOR_ == 0) && (_BOARD_REVISION_MINOR_ < 3))
pins_out(0, (1 << LED_PIN.pin), 0);
#elif ((_BOARD_REVISION_MAJOR_ == 0) && (_BOARD_REVISION_MINOR_ < 6))
pins_out(0, (1 << LED_PIN.pin) | (1 << SIDEBAND_RESET.pin), 0);
#else
// Set up output pins (LED and USB switch control)
pins_out(0, (1 << LED_PIN.pin) | (1 << USB_SWITCH.pin), 0);

// Take over USB port in board revisions >=0.6
pin_high(USB_SWITCH);
#endif
/*
* Cynthion r0.3 through r0.5 do not have a USB switch. On these
* platforms the Sideband PHY RESET is pulled low to ensure that it
* does not interfere with the bootloader's use of the Sideband USB
* port. The output is explicitly enabled but implicitly driven low (by
* reset default). Sideband PHY usage is unsupported on Cynthion r0.1
* and r0.2.
*/


// Set up the main clocks.
clock_init_usb(GCLK_SYSTEM);
Expand Down

0 comments on commit 1248588

Please sign in to comment.