lnls-dig / openMMC

Open source firmware for MMC controllers
GNU General Public License v3.0
39 stars 32 forks source link

FMC power good signal handling (by Rene Geissler) #105

Closed lerwys closed 7 months ago

lerwys commented 3 years ago

From an email by Rene Geissler:

I was recently experimenting with a commercial FMC ADC board mounted on an AFC v3.1 FMC carrier. I observed that with the current openMMC firmware, the FMC boards do not power up because the PG_C2M pins on the FMC connectors are driven low.

The boards power up with the following changes:

diff --git a/port/board/afc-bpm/v3_1/pin_mapping.h b/port/board/afc-bpm/v3_1/pin_mapping.h index a39868b..f738733 100644 --- a/port/board/afc-bpm/v3_1/pin_mapping.h +++ b/port/board/afc-bpm/v3_1/pin_mapping.h @@ -160,8 +160,8 @@ / FMC Power Good signals /

define GPIO_FMC1_PG_M2C PIN_DEF( PORT1, 16,

(IOCON_FUNC0 | IOCON_MODE_PULLUP), GPIO_DIR_INPUT )

define GPIO_FMC2_PG_M2C PIN_DEF( PORT1, 17,

(IOCON_FUNC0 | IOCON_MODE_PULLUP), GPIO_DIR_INPUT ) -#define GPIO_FMC1_PG_C2M PIN_DEF( PORT1, 18, (IOCON_FUNC0 | IOCON_MODE_PULLUP), GPIO_DIR_OUTPUT ) -#define GPIO_FMC2_PG_C2M PIN_DEF( PORT1, 19, (IOCON_FUNC0 | IOCON_MODE_PULLUP), GPIO_DIR_OUTPUT ) +#define GPIO_FMC1_PG_C2M PIN_DEF( PORT1, 18, (IOCON_FUNC0 | IOCON_MODE_PULLUP), GPIO_DIR_INPUT ) +#define GPIO_FMC2_PG_C2M PIN_DEF( PORT1, 19, (IOCON_FUNC0 | IOCON_MODE_PULLUP), GPIO_DIR_INPUT )

By configuring the power good pins as inputs, they will be pulled high by external pullup resistors on the AFC board.

I think my change to the firmware might also be suitable for the mainline because in the ANSI/VITA FMC standard it says:

PG_C2M: Active high power good signal. High indicates that VADJ, 12P0V, and 3P3V are within tolerance.

The FMC boards I have used before together with AFC boards do not evaluate the power good signals, so that they should not be affected by this change.

augustofg commented 7 months ago

Maybe the correct action should be to set those pins to HIGH when handling the PAYLOAD_STATE_FPGA_SETUP state in the vTaskPayload task?

https://github.com/lnls-dig/openMMC/blob/37e2ad0a455ec083b97880bf4d86845af8102baa/port/board/afc-v3/payload.c#L313-L322

And set then back to LOW when DCDC_good is false or when handling the PAYLOAD_SWITCHING_OFF state.