More commenting around the BK chip registers

This commit is contained in:
OneOfEleven 2023-09-18 16:58:36 +01:00
parent f55c63e2af
commit 39c0f0afac
6 changed files with 118 additions and 39 deletions

View File

@ -460,33 +460,90 @@ void APP_StartListening(FUNCTION_Type_t Function)
}
if (gRxVfo->IsAM)
{
// RX AF level
BK4819_WriteRegister(BK4819_REG_48, 0xB3A8);
{ // AM
// help improve AM RX audio by reducing the PGA gain
// RX AF level
//
// I think the solution is to set the RX AGC to limit the front end/I.F gain
// REG_48 <15:12> 11 ??????
//
// REG_48 <11:10> 0 AF Rx Gain-1
// 0 = 0dB
// 1 = -6dB
// 2 = -12dB
// 3 = -18dB
//
// REG_48 <9:4> 60 AF Rx Gain-2 -26dB ~ 5.5dB 0.5dB/step
// 63 = max
// 0 = mute
//
// REG_48 <3:0> 15 AF DAC Gain (after Gain-1 and Gain-2)
// 15 = max
// 0 = min
// approx 2dB/step
//
BK4819_WriteRegister(BK4819_REG_48,
#if 0
(11u << 12) | // ???
( 0u << 10) | // AF Rx Gain-1
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
#else
(11u << 12) | // ???
( 0u << 10) | // AF Rx Gain-1
(63u << 4) | // AF Rx Gain-2
(15u << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
#endif
BK4819_WriteRegister(0x4B, BK4819_ReadRegister(0x4B) & ~(1u << 5)); // enable RX ALC
// help improve AM RX distorted audio by reducing the PGA gain (still bad with stronger signals
//
// I think the proper solution is to set the RX AGC to limit the front end/I.F gain
//
// LNA_SHORT .. 0dB
// LNA ........ 14dB
// MIXER ...... 0dB
// PGA ........ -15dB
//
// LNA SHORT LNA MIXER PGA
BK4819_WriteRegister(BK4819_REG_13, (3u << 8) | (2u << 5) | (3u << 3) | (3u << 0));
gNeverUsed = 0;
}
else
{
{ // FM
// RX AF level
BK4819_WriteRegister(BK4819_REG_48, 0xB000 | (gEeprom.VOLUME_GAIN << 4) | (gEeprom.DAC_GAIN << 0));
//
// REG_48 <15:12> 11 ??????
//
// REG_48 <11:10> 0 AF Rx Gain-1
// 0 = 0dB
// 1 = -6dB
// 2 = -12dB
// 3 = -18dB
//
// REG_48 <9:4> 60 AF Rx Gain-2 -26dB ~ 5.5dB 0.5dB/step
// 63 = max
// 0 = mute
//
// REG_48 <3:0> 15 AF DAC Gain (after Gain-1 and Gain-2)
// 15 = max
// 0 = min
// approx 2dB/step
//
BK4819_WriteRegister(BK4819_REG_48,
(11u << 12) | // ???
( 0u << 10) | // AF Rx Gain-1
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
BK4819_WriteRegister(0x4B, BK4819_ReadRegister(0x4B) | (1u << 5)); // disable RX ALC
// LNA_SHORT .. 0dB
// LNA ........ 14dB
// MIXER ...... 0dB
// PGA ........ -3dB
//
// LNA SHORT LNA MIXER PGA
BK4819_WriteRegister(BK4819_REG_13, (3u << 8) | (2u << 5) | (3u << 3) | (6u << 0));
}

View File

@ -58,7 +58,29 @@ void BK4819_Init(void)
BK4819_WriteRegister(BK4819_REG_7D, 0xE940);
// RX AF level
BK4819_WriteRegister(BK4819_REG_48, 0xB3A8);
//
// REG_48 <15:12> 11 ??????
//
// REG_48 <11:10> 0 AF Rx Gain-1
// 0 = 0dB
// 1 = -6dB
// 2 = -12dB
// 3 = -18dB
//
// REG_48 <9:4> 60 AF Rx Gain-2 -26dB ~ 5.5dB 0.5dB/step
// 63 = max
// 0 = mute
//
// REG_48 <3:0> 15 AF DAC Gain (after Gain-1 and Gain-2)
// 15 = max
// 0 = min
// approx 2dB/step
//
BK4819_WriteRegister(BK4819_REG_48, // 0xB3A8); // 1011 00 111010 1000
(11u << 12) | // ???
( 0u << 10) | // AF Rx Gain-1
(58u << 4) | // AF Rx Gain-2
( 8u << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
const uint8_t dtmf_coeffs[] = {0x6F,0x6B,0x67,0x62,0x50,0x47,0x3A,0x2C,0x41,0x37,0x25,0x17,0xE4,0xCB,0xB5,0x9F};
for (unsigned int i = 0; i < ARRAY_SIZE(dtmf_coeffs); i++)

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -138,19 +138,19 @@ void UI_DisplayMain(void)
// highlight the selected/used VFO with a marker
if (!single_vfo && bIsSameVfo)
memmove(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
memmove(pLine0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
else
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
memmove(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
memmove(pLine0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
}
else
if (!single_vfo)
{ // highlight the selected/used VFO with a marker
if (bIsSameVfo)
memmove(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
memmove(pLine0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
else
//if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
memmove(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
memmove(pLine0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
}
uint32_t SomeValue = 0;