Skip to content

Conversation

@Akshat412
Copy link
Collaborator

@Akshat412 Akshat412 commented May 5, 2025

A (potential) software fix to the RX nonsense we have been seeing on comms for the last couple of weeks.

Implements AGC configuration according to the datasheet for the SX1262:
image

AGC is unconfigured in both the E22 and RFM9x drivers. However, it seems the AGC for the SX1262 (E22-400M-30S) is default configured for 915 MHz, and the SX1276 (RFM98PW) is configured for 434 MHz. This probably explains why the RFM98PW worked for previous missions.

@Akshat412 Akshat412 marked this pull request as ready for review May 6, 2025 17:51
@Akshat412 Akshat412 requested a review from perrintong325 as a code owner May 6, 2025 17:51
Copy link
Contributor

@Ibrassow Ibrassow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoever is testing this (I assume @ChromeUniverse ), please post results in any form on the PR

Comment on lines +1052 to +1108
self.readRegister(_SX126X_REG_AGC_RSSI_MEAS_CAL_L, temp_mv, 1)
print(f"_SX126X_REG_AGC_RSSI_MEAS_CAL_L: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_1_2, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_1_2: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_3_4, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_3_4: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_5_6, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_5_6: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_7_8, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_7_8: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_9_10, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_9_10: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_11_12, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_11_12: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_13, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_13: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_G_FORST_POW_THR, temp_mv, 1)
print(f"_SX126X_REG_AGC_G_FORST_POW_THR: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_RX_GAIN, temp_mv, 1)
print(f"_SX126X_REG_RX_GAIN: {temp[0]}")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the prints before merge

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the call to this function. The function should be kept for debugging if ever needed for modifications to this whole business.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still, this is not enough; I would remove the prints or comment them out. Can't make any assumption on the external function usage or that it won't be used, so need to take the precaution here

Copy link
Contributor

@Ibrassow Ibrassow Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything under flight/ should be print sanitized @ChromeUniverse honestly

And honestly this belongs to scripts/ instead of the hal

@Akshat412 Akshat412 requested a review from Ibrassow June 27, 2025 17:37
Comment on lines +1052 to +1108
self.readRegister(_SX126X_REG_AGC_RSSI_MEAS_CAL_L, temp_mv, 1)
print(f"_SX126X_REG_AGC_RSSI_MEAS_CAL_L: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_1_2, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_1_2: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_3_4, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_3_4: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_5_6, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_5_6: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_7_8, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_7_8: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_9_10, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_9_10: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_11_12, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_11_12: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_13, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_13: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_G_FORST_POW_THR, temp_mv, 1)
print(f"_SX126X_REG_AGC_G_FORST_POW_THR: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_RX_GAIN, temp_mv, 1)
print(f"_SX126X_REG_RX_GAIN: {temp[0]}")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still, this is not enough; I would remove the prints or comment them out. Can't make any assumption on the external function usage or that it won't be used, so need to take the precaution here

Comment on lines +1052 to +1108
self.readRegister(_SX126X_REG_AGC_RSSI_MEAS_CAL_L, temp_mv, 1)
print(f"_SX126X_REG_AGC_RSSI_MEAS_CAL_L: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_1_2, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_1_2: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_3_4, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_3_4: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_5_6, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_5_6: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_7_8, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_7_8: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_9_10, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_9_10: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_11_12, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_11_12: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_GAIN_TUNE_13, temp_mv, 1)
print(f"_SX126X_REG_AGC_GAIN_TUNE_13: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_AGC_G_FORST_POW_THR, temp_mv, 1)
print(f"_SX126X_REG_AGC_G_FORST_POW_THR: {temp[0]}")

temp = bytearray(1)
temp_mv = memoryview(temp)

self.readRegister(_SX126X_REG_RX_GAIN, temp_mv, 1)
print(f"_SX126X_REG_RX_GAIN: {temp[0]}")

Copy link
Contributor

@Ibrassow Ibrassow Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything under flight/ should be print sanitized @ChromeUniverse honestly

And honestly this belongs to scripts/ instead of the hal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants