Mitch Bailey
01/17/2024, 1:34 AMhtamas
01/17/2024, 2:42 AMGPIO_MODE_USER_STD_OUTPUT for fixed outputs, for the use case where I pull the pin up/down during boot and then reconfigure it to GPIO_MODE_MGMT_* from firmware.htamas
01/17/2024, 2:57 AMMitch Bailey
01/17/2024, 4:03 AMGPIO_MODE_MGMT_STD_INPUT_PULLUP or GPIO_MODE_MGMT_STD_INPUT_PULLDOWN as the default and reprogramming from firmware.htamas
01/17/2024, 4:31 AMINPUT modes for output functionality. By the way, how do the drive strengths compare?Mitch Bailey
01/17/2024, 4:47 AMhtamas
01/17/2024, 5:24 AMGPIO_MODE_MGMT_STD_INPUT_PULLUP. Then the output will be either a weak 1 or a strong 0, depending on the output from the management core, which hasn't finished booting yet. Am I missing something?Mitch Bailey
01/17/2024, 5:59 AMgpio_control_block will set the pull up/down levels for mgmt modes.
From caravel/verilog/rtl/gpio_control_block.v
/* For 2-wire interfaces, the mgmt_gpio_oeb line is tied high at */
/* the control block. In this case, the output enable state is */
/* determined by the OEB configuration bit. */
assign pad_gpio_outenb = (mgmt_ena) ? ((mgmt_gpio_oeb == 1'b1) ?
gpio_outenb : 1'b0) : user_gpio_oeb;
/* For 2-wire interfaces, if the pad is configured for pull-up or */
/* pull-down, drive the output value locally to achieve the */
/* expected pull. */
assign pad_gpio_out = (mgmt_ena) ? ((mgmt_gpio_oeb == 1'b1) ?
((gpio_dm[2:1] == 2'b01) ? ~gpio_dm[0] : mgmt_gpio_out) :
mgmt_gpio_out) : user_gpio_out;
pad_* signals connect to the actual gpio.
mgmt_* signals are mostly from the management core (mgmt_ena is the low bit of the gpio defaults).
user_* signals are from the user area.
gpio_* signals are the programmed constants.
In response to your question, for GPIO_MODE_MGMT_STD_INPUT_PULLUP and GPIO_MODE_MGMT_STD_INPUT_PULLDOWN, (if mgmt_gpio_oeb is high), the output level is determined by the constant gpio_dm[2:0] and is not dependent on the mgmt_gpio_out level.
I suppose there could be a problem if mgmt_gpio_oeb was low during power up.
@Tim Edwards are the mgmt_gpio_oeb levels guaranteed during the power on sequence?htamas
01/17/2024, 7:32 AMmgmt_gpio_oeb is high, then GPIO_MODE_MGMT_STD_INPUT_PULLUP is guaranteed to put a weak 1 on the pad (as opposed to a strong 1 with GPIO_MODE_USER_STD_OUTPUT, but it should be fine as long as the interfacing IC doesn't use a pull-down).htamas
01/17/2024, 7:41 AMGPIO_MODE_USER_STD_OUTPUT_BIDIRECTIONAL. But this would fail your test as the input pin is not connected to the user project.Mitch Bailey
01/17/2024, 10:20 AMOk, so ifThat is my understanding.is high, thenmgmt_gpio_oebis guaranteed to put a weak 1 on the pad (as opposed to a strong 1 withGPIO_MODE_MGMT_STD_INPUT_PULLUP, but it should be fine as long as the interfacing IC doesn’t use a pull-down).GPIO_MODE_USER_STD_OUTPUT
Let’s say I’d like to use a pin as an output from the user project, but also send it to the management coreIn this case, I believe the expected default is
GPIO_MODE_USER_STD_OUT_MONITORED although technically your suggestion of GPIO_MODE_USER_STD_OUTPUT_BIDIRECTIONAL would also work. The only difference between the 2 defaults is the OUTPUT_DISABLE bit, but as shown in the gpio_control_block code above, this bit (gpio_outenb) is not used in user modes.Tim Edwards
01/17/2024, 2:18 PMMitch Bailey
01/17/2024, 4:28 PMGPIO_MODE_MGMT_STD_INPUT_PULLDOWN mode is equivalent to the GPIO_MODE_USER_STD_INPUT_PULLDOWN mode but you don’t need to set io_out and io_oeb if you use GPIO_MODE_MGMT_STD_INPUT_PULLDOWN.
Looks like this might only be correct when mgmt_io_oeb is high. Is mgmt_io_oeb high by default?Tim Edwards
01/17/2024, 4:32 PMmgmt_gpio_oeb is tied high for all GPIOs except 0, 1, and 35 to 37.Tim Edwards
01/17/2024, 4:36 PMmgmt_gpio_oeb is set to the value of the configure word bit 4 (input disable) for the copy of the GPIO configuration that's inside housekeeping.Mitch Bailey
01/17/2024, 5:29 PMGPIO_MODE_MGMT_STD_INPUT_PULLUP/DOWN may not be strictly equivalent to GPIO_MODE_USER_STD_INPUT_PULLUP/DOWN with the correct io_out and io_oeb for all gpio.
For these 5 gpio in GPIO_MODE_MGMT_STD_INPUT_PULLUP/DOWN mode, INPUT_DISABLE will be low, meaning mgmt_gpio_oeb will also be low when the management function is not active. This means that pad_gpio_outenb will be low and pad_gpio_out will be mgmt_gpio_out which may or may not be the level expected.
Is that correct?Tim Edwards
01/17/2024, 6:55 PMMitch Bailey
01/18/2024, 12:42 AMgpio_control_block in this case.
Let’s say the user wants to use a gpio for input with a pullup/down but didn’t connect the user io_out and/or io_oeb.
For gpio 2 - 34, I believe using GPIO_MODE_MGMT_STD_INPUT_PULLUP/DOWN will work.
For gpio 0, 1, 35, 36, 37, will it be a 2 step process? First, program the gpio with GPIO_MODE_MGMT_STD_INPUT_PULLUP/DOWN, and then overwrite the configuration in the housekeeping module for that gpio with a value that has INPUT_DISABLE high? So the gpio is actually in input mode, but the housekeeping module thinks input mode is disabled.Tim Edwards
01/18/2024, 3:31 AM