-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: convert configurations from Legacy #155
Comments
It's important to first determine which calibrations are actually required and meaningful in practice. The fact that something can be calibrated (deviate from the datasheet and nominal values) doesn't mean that it should be calibrated. The calibration may actually be less accurate than the on-paper value and on top of that VSWR or things like sinara-hw/Booster#375 may make the calibrated values less meaningful than the default ones in several cases. This was and is unclear and it is also unclear to what extent data from the old firmware actually provides a benefit for the new one. My gut feeling is that state, bias and interlock threshold are the only useful and meaningful ones. Other than that, sure, on-the-fly conversion of old data would be really nice where this is meaningful and once tested thoroughly to be working robustly. Without having checked anything, the |
@jordens Thanks for the comments. I know the answer to your concern about stm32-rs/stm32f4xx-hal: ADC digital full-scale value is STMicroelectronics/STM32CubeF4: ADC digital full-scale value is
So apparently, STM32 ADC works differently from ADC ICs (DAC7571, MCP3221). Digging deeper, I found a difference in terms of "last code transition" between STM32 ADC and MCP3221: STM32 ADC (manual):
MCP3221 (datasheet):
I can't find similar info for DAC7571, but this StackExchange comment also suggests that the max binary code normally can't differentiate Vref from Vref - 1.5 LSB. So I think STM32 ADC is a special case. |
No. Also for the STM32F4 the scale is one LSB per VREF/4096. See e.g. page 10 of the manual you quote. |
@jordens Thank you for the advice! I've opened an issue here: stm32-rs/stm32f4xx-hal#362 |
Hi to all, in M-Labs we have come across the lack of compatibility between Legacy firmware and NGFW in terms of configuration data format stored in the EEPROMs. Given a set of data calibrated using Legacy, I'd like to propose a documentation on interpreting the existing data in Legacy format, and convert them to NGFW, possibly done manually or in code with a future PR.
I'm only aware of a similar discussion about documenting NGFW calibration on #107. Please remind me of other threads related to this topic if there's any.
My draft is presented as follows. Please also feel free to point out any mistakes.
Harry's draft
Conversion
Perform conversion to power (in dBm) as required by NGFW.
("EEPROM
@n
<SYMBOL>" indicates a value for SYMBOL stored at the byte address n, in decimal; Legacy EEPROM is big-endian)Step 1: Output power transform
Target: <output_power_transform>
Source:
Channel EEPROM
@24
<ADC1_SCALE>Channel EEPROM
@20
<ADC1_OFFSET>Conversion:
a
, and 16-bit <ADC1_OFFSET> as offsetb
. Both are unsigned 16-bit integers. They inversely transform a 16-bit ADC raw sample back to power in dBm:sample = a * power + b
==>power = (sample - b) / a
main.rs
) and resolution = 12 bits (default value, seestm32f4xx_hal::adc::config::AdcConfig
, and STM32 manual RM0090, section 13.13.2 about ADC_CR1), find linear transformation from voltage (in V) to power:voltage = (sample * 2.5) / ((1 \<\< 12) - 1)
(Note: double check with
stm32f4xx_hal::adc::Adc::sample_to_millivolts()
implementation)power = (voltage * 4095.0 / 2.5 - b) / a = (4095.0 / 2.5 / a) * voltage + (-b / a)
power = c * voltage + d
, whereslope:
c = 4095.0 / 2.5 / a
offset:
d = -b / a
Step 2: Output interlock threshold
Target: <output_interlock_threshold>
Source:
Channel EEPROM
@18
<DAC2>Channel EEPROM
@30
<HW_INT_SCALE> - see footnoteChannel EEPROM
@34
<HW_INT_OFFSET> - see footnoteConversion:
voltage = (code >> 4) / (0x1000) * 2.5
(see
Ad5627::set_voltage()
)Footnote:
Step 3: Bias voltage
Target: <bias_voltage>
Source:
Channel EEPROM
@28
<BIAS_DAC_VALUE>Conversion:
voltage = code / 4096.0 * 3.3
(assume
Dac7571::default()
; seeDac7571::set_voltage()
)rf_channel::set_bias()
:voltage := -1.0 * voltage
(see comment on
rf_channel::set_bias()
)Footnote:
rf_channel::set_bias()
.Step 4: Channel state (optional)
(The Legacy firmware doesn't provide user-facing commands for reading main EEPROM via VCP interface)
Target: <enabled>
Source:
Board EEPROM
@30
<POWERCFG_STATUS>Conversion:
Step 5: Input power transform
Target: <input_power_transform>
Source:
Channel EEPROM
@38
<INPUT_CAL_SCALE>Channel EEPROM
@42
<INPUT_CAL_OFFSET>Conversion:
power = a * sample + b
voltage = code / 4096.0 * 3.3
(assume
Mcp3221::default()
; seeMcp3221::get_voltage()
)power = a * (voltage * 4096.0 / 3.3) + b
slope:
c = a * 4096.0 / 3.3
offset:
d = b
Step 6: Reflected power transform
Target: <reflected_power_transform>
Source:
Channel EEPROM
@26
<ADC2_SCALE>Channel EEPROM
@22
<ADC2_OFFSET>Conversion:
The text was updated successfully, but these errors were encountered: