![]() |
PU2CLR Si4735 Arduino Library
2.0.7
Arduino Library for Si47XX Devices - By Ricardo Lima Caratti
|
Single Side Band (SSB) implementation.
First of all, it is important to say that the SSB patch content is not part of this library. The paches used here were made available by Mr. Vadim Afonkin on his Dropbox repository. It is important to note that the author of this library does not encourage anyone to use the SSB patches content for commercial purposes. In other words, this library only supports SSB patches, the patches themselves are not part of this library.
More...
Functions | |
uint16_t | SI4735::getAntennaTuningCapacitor () |
Get the Antenna Tuning Capacitor value. More... | |
void | SI4735::setAvcAmMaxGain () |
Sets the Avc Am Max Gain to 48dB. More... | |
uint8_t | SI4735::getCurrentAvcAmMaxGain () |
Get the current Avc Am Max Gain. More... | |
void | SI4735::setAmSoftMuteMaxAttenuation (uint8_t smattn=0) |
Sets the Am Soft Mute Max Attenuation. More... | |
void | SI4735::setFmSoftMuteMaxAttenuation (uint8_t smattn=0) |
Sets the Fm Soft Mute Max Attenuation. More... | |
void | SI4735::setSsbSoftMuteMaxAttenuation (uint8_t smattn=0) |
Sets the SSB Soft Mute Max Attenuation object. More... | |
void | SI4735::setSsbAgcAttackRate (uint16_t parameter) |
Sets the AGC attack rate on SSB mode. More... | |
void | SI4735::setSsbAgcReleaseRate (uint16_t parameter) |
Sets the AGC Release rate on SSB mode. More... | |
void | SI4735::setSSBBfo (int offset) |
Sets the SSB Beat Frequency Offset (BFO). More... | |
void | SI4735::setSSBConfig (uint8_t AUDIOBW, uint8_t SBCUTFLT, uint8_t AVC_DIVIDER, uint8_t AVCEN, uint8_t SMUTESEL, uint8_t DSP_AFCDIS) |
Sets the SSB receiver mode. More... | |
void | SI4735::setSSBDspAfc (uint8_t DSP_AFCDIS) |
Sets DSP AFC disable or enable. More... | |
void | SI4735::setSSBSoftMute (uint8_t SMUTESEL) |
Sets SSB Soft-mute Based on RSSI or SNR Selection: More... | |
void | SI4735::setSSBAutomaticVolumeControl (uint8_t AVCEN) |
Sets SSB Automatic Volume Control (AVC) for SSB mode. More... | |
void | SI4735::setSSBAvcDivider (uint8_t AVC_DIVIDER) |
Sets AVC Divider. More... | |
void | SI4735::setSBBSidebandCutoffFilter (uint8_t SBCUTFLT) |
Sets SBB Sideband Cutoff Filter for band pass and low pass filters. More... | |
void | SI4735::setSSBAudioBandwidth (uint8_t AUDIOBW) |
SSB Audio Bandwidth for SSB mode. More... | |
void | SI4735::setSSB (uint8_t usblsb) |
Set the radio to AM function. More... | |
void | SI4735::setSSB (uint16_t fromFreq, uint16_t toFreq, uint16_t intialFreq, uint16_t step, uint8_t usblsb) |
void | SI4735::sendSSBModeProperty () |
Just send the property SSB_MOD to the device. Internal use (privete method). More... | |
void | SI4735::getSsbAgcStatus () |
Queries SSB Automatic Gain Control STATUS. More... | |
void | SI4735::setSsbAgcOverrite (uint8_t SSBAGCDIS, uint8_t SSBAGCNDX) |
Automatic Gain Control setup. More... | |
si47x_firmware_query_library | SI4735::queryLibraryId () |
Query the library information of the Si47XX device. More... | |
void | SI4735::patchPowerUp () |
This method can be used to prepare the device to apply SSBRX patch. More... | |
void | SI4735::ssbPowerUp () |
This function can be useful for debug and test. More... | |
bool | SI4735::downloadPatch (const uint8_t *ssb_patch_content, const uint16_t ssb_patch_content_size) |
Transfers the content of a patch stored in a array of bytes to the SI4735 device. More... | |
bool | SI4735::downloadCompressedPatch (const uint8_t *ssb_patch_content, const uint16_t ssb_patch_content_size, const uint16_t *cmd_0x15, const int16_t cmd_0x15_size) |
Same downloadPatch. More... | |
void | SI4735::loadPatch (const uint8_t *ssb_patch_content, const uint16_t ssb_patch_content_size, uint8_t ssb_audiobw=1) |
Loads a given SSB patch content. More... | |
si4735_eeprom_patch_header | SI4735::downloadPatchFromEeprom (int eeprom_i2c_address) |
Transfers the content of a patch stored in an eeprom to the SI4735 device. More... | |
Single Side Band (SSB) implementation.
First of all, it is important to say that the SSB patch content is not part of this library. The paches used here were made available by Mr. Vadim Afonkin on his Dropbox repository. It is important to note that the author of this library does not encourage anyone to use the SSB patches content for commercial purposes. In other words, this library only supports SSB patches, the patches themselves are not part of this library.
This implementation was tested only on Si4735-D60 and SI4732-A10 devices.
SSB modulation is a refinement of amplitude modulation that one of the side band and the carrier are suppressed.
What does SSB patch means? In this context, a patch is a piece of software used to change the behavior of the SI4735-D60/SI4732-A10 device. There is little information available about patching the SI4735-D60/SI4732-A10.
The following information is the understanding of the author of this project and it is not necessarily correct.
A patch is executed internally (run by internal MCU) of the device. Usually, patches are used to fixes bugs or add improvements and new features of the firmware installed in the internal ROM of the device. Patches to the SI4735 are distributed in binary form and have to be transferred to the internal RAM of the device by the host MCU (in this case Arduino boards). Since the RAM is volatile memory, the patch stored into the device gets lost when you turn off the system. Consequently, the content of the patch has to be transferred again to the device each time after turn on the system or reset the device.
I would like to thank Mr Vadim Afonkin for making available the SSBRX patches for SI4735-D60/SI4732-A10 on his Dropbox repository. On this repository you have two files, amrx_6_0_1_ssbrx_patch_full_0x9D29.csg and amrx_6_0_1_ssbrx_patch_init_0xA902.csg. It is important to know that the patch content of the original files is constant hexadecimal representation used by the language C/C++. Actally, the original files are in ASCII format (not in binary format). If you are not using C/C++ or if you want to load the files directly to the SI4735, you must convert the values to numeric value of the hexadecimal constants. For example: 0x15 = 21 (00010101); 0x16 = 22 (00010110); 0x01 = 1 (00000001); 0xFF = 255 (11111111);
ATTENTION: The author of this project does not guarantee that procedures shown here will work in your development environment. Given this, it is at your own risk to continue with the procedures suggested here. This library works with the I²C communication protocol and it is designed to apply a SSB extension PATCH to
SI4735-D60 and SI4732-A10 devices. Once again, the author disclaims any liability for any damage this procedure may cause to your SI4735-D60 or SI4732-A10 or other devices that you are using.
|
inline |
Get the Antenna Tuning Capacitor value.
Returns the current antenna tuning capacitor value. The tuning capacitance is 95 fF x READANTCAP + 7 pF.
ON AM or SSB mode, the MULT attribute sotores the high byte of READANTCAP and the attribute READANTCAP by itself stores the low byte.
|
inline |
Sets the Avc Am Max Gain to 48dB.
|
inline |
Get the current Avc Am Max Gain.
|
inline |
Sets the Am Soft Mute Max Attenuation.
This function can be useful to disable Soft Mute. The value 0 disable soft mute.
Specified in units of dB. Default maximum attenuation is 8 dB. It works for AM and SSB.
smattn | Maximum attenuation to apply when in soft mute |
|
inline |
Sets the Fm Soft Mute Max Attenuation.
This function can be useful to disable Soft Mute on FM mode. The value 0 disable soft mute.
Specified in units of dB. Default maximum attenuation is 8 dB. It works for AM and SSB.
smattn | Maximum attenuation to apply when in soft mute |
|
inline |
Sets the SSB Soft Mute Max Attenuation object.
Sets maximum attenuation during soft mute (dB). Set to 0 to disable soft mute.
Specified in units of dB. Default maximum attenuation is 8 dB.
You can use setAmSoftMuteMaxAttenuation instead. Same AM property values.
smattn | Maximum attenuation to apply when in soft mute. |
|
inline |
Sets the AGC attack rate on SSB mode.
Large values provide slower attack, and smaller values provide faster attack..
parameter | Range: 4–248 (The default is 0x04) |
|
inline |
Sets the AGC Release rate on SSB mode.
Larger values provide slower release, and smaller values provide faster release.
parameter | Range: 4–248 (The default is 0x18) |
void SI4735::setSSBBfo | ( | int | offset | ) |
Sets the SSB Beat Frequency Offset (BFO).
offset | 16-bit signed value (unit in Hz). The valid range is -16383 to +16383 Hz. |
References SI4735::waitToSend().
void SI4735::setSSBConfig | ( | uint8_t | AUDIOBW, |
uint8_t | SBCUTFLT, | ||
uint8_t | AVC_DIVIDER, | ||
uint8_t | AVCEN, | ||
uint8_t | SMUTESEL, | ||
uint8_t | DSP_AFCDIS | ||
) |
Sets the SSB receiver mode.
You can use this method for:
1) Enable or disable AFC track to carrier function for receiving normal AM signals;
2) Set the audio bandwidth;
3) Set the side band cutoff filter;
4) Set soft-mute based on RSSI or SNR;
5) Enable or disbable automatic volume control (AVC) function.
AUDIOBW | SSB Audio bandwidth; 0 = 1.2kHz (default); 1=2.2kHz; 2=3kHz; 3=4kHz; 4=500Hz; 5=1kHz. |
SBCUTFLT | SSB side band cutoff filter for band passand low pass filter if 0, the band pass filter to cutoff both the unwanted side band and high frequency component > 2kHz of the wanted side band (default). |
AVC_DIVIDER | set 0 for SSB mode; set 3 for SYNC mode. |
AVCEN | SSB Automatic Volume Control (AVC) enable; 0=disable; 1=enable (default). |
SMUTESEL | SSB Soft-mute Based on RSSI or SNR. |
DSP_AFCDIS | DSP AFC Disable or enable; 0=SYNC MODE, AFC enable; 1=SSB MODE, AFC disable. |
References SI4735::sendSSBModeProperty().
void SI4735::setSSBDspAfc | ( | uint8_t | DSP_AFCDIS | ) |
Sets DSP AFC disable or enable.
DSP_AFCDIS | 0 = SYNC mode, AFC enable; 1 = SSB mode, AFC disable |
References SI4735::sendSSBModeProperty().
void SI4735::setSSBSoftMute | ( | uint8_t | SMUTESEL | ) |
Sets SSB Soft-mute Based on RSSI or SNR Selection:
SMUTESEL | 0 = Soft-mute based on RSSI (default); 1 = Soft-mute based on SNR. |
References SI4735::sendSSBModeProperty().
void SI4735::setSSBAutomaticVolumeControl | ( | uint8_t | AVCEN | ) |
Sets SSB Automatic Volume Control (AVC) for SSB mode.
AVCEN | 0 = Disable AVC; 1 = Enable AVC (default). |
References SI4735::sendSSBModeProperty().
void SI4735::setSSBAvcDivider | ( | uint8_t | AVC_DIVIDER | ) |
Sets AVC Divider.
AVC_DIVIDER | SSB mode, set divider = 0; SYNC mode, set divider = 3; Other values = not allowed. |
References SI4735::sendSSBModeProperty().
void SI4735::setSBBSidebandCutoffFilter | ( | uint8_t | SBCUTFLT | ) |
Sets SBB Sideband Cutoff Filter for band pass and low pass filters.
0 = Band pass filter to cutoff both the unwanted side band and high frequency components > 2.0 kHz of the wanted side band. (default)
1 = Low pass filter to cutoff the unwanted side band. Other values = not allowed.
SBCUTFLT | 0 or 1; see above |
References SI4735::sendSSBModeProperty().
void SI4735::setSSBAudioBandwidth | ( | uint8_t | AUDIOBW | ) |
SSB Audio Bandwidth for SSB mode.
0 = 1.2 kHz low-pass filter (default).
1 = 2.2 kHz low-pass filter.
2 = 3.0 kHz low-pass filter.
3 = 4.0 kHz low-pass filter.
4 = 500 Hz band-pass filter for receiving CW signal, i.e. [250 Hz, 750 Hz] with center frequency at 500 Hz when USB is selected or [-250 Hz, -750 1Hz] with center frequency at -500Hz when LSB is selected* .
5 = 1 kHz band-pass filter for receiving CW signal, i.e. [500 Hz, 1500 Hz] with center frequency at 1 kHz when USB is selected or [-500 Hz, -1500 1 Hz] with center frequency at -1kHz when LSB is selected.
Other values = reserved.
If audio bandwidth selected is about 2 kHz or below, it is recommended to set SBCUTFLT[3:0] to 0 to enable the band pass filter for better high- cut performance on the wanted side band. Otherwise, set it to 1.
AUDIOBW | the valid values are 0, 1, 2, 3, 4 or 5; see description above |
References SI4735::sendSSBModeProperty().
void SI4735::setSSB | ( | uint8_t | usblsb | ) |
Set the radio to AM function.
Set the radio to SSB (LW/MW/SW) function.
usblsb | upper or lower side band; 1 = LSB; 2 = USB |
References SI4735::radioPowerUp().
void SI4735::setSSB | ( | uint16_t | fromFreq, |
uint16_t | toFreq, | ||
uint16_t | initialFreq, | ||
uint16_t | step, | ||
uint8_t | usblsb | ||
) |
Tunes the SSB (LSB or USB) receiver to a frequency between 520 and 30 MHz in 1 kHz steps.
fromFreq | minimum frequency for the band |
toFreq | maximum frequency for the band |
initialFreq | initial frequency |
step | step used to go to the next channel |
usblsb | SSB Upper Side Band (USB) and Lower Side Band (LSB) Selection; value 2 (banary 10) = USB; value 1 (banary 01) = LSB. |
|
protected |
Just send the property SSB_MOD to the device. Internal use (privete method).
References SI4735::waitToSend().
Referenced by SI4735::setSBBSidebandCutoffFilter(), SI4735::setSSBAudioBandwidth(), SI4735::setSSBAutomaticVolumeControl(), SI4735::setSSBAvcDivider(), SI4735::setSSBConfig(), SI4735::setSSBDspAfc(), and SI4735::setSSBSoftMute().
|
protected |
Queries SSB Automatic Gain Control STATUS.
After call this method, you can call isAgcEnabled to know the AGC status and getAgcGainIndex to know the gain index value.
References SI4735::waitToSend().
|
protected |
Automatic Gain Control setup.
Overrides the SSB AGC setting by disabling the AGC and forcing the gain index that ranges between 0 (minimum attenuation) and 37+ATTN_BACKUP (maximum attenuation).
uint8_t | SSBAGCDIS This param selects whether the AGC is enabled or disabled (0 = AGC enabled; 1 = AGC disabled); |
uint8_t | SSBAGCNDX If 1, this byte forces the AGC gain index. if 0, Minimum attenuation (max gain) |
References SI4735::waitToSend().
si47x_firmware_query_library SI4735::queryLibraryId | ( | ) |
Query the library information of the Si47XX device.
SI47XX PATCH RESOURCES
Used to confirm if the patch is compatible with the internal device library revision.
You have to call this function if you are applying a patch on SI47XX (SI4735-D60/SI4732-A10).
The first command that is sent to the device is the POWER_UP command to confirm that the patch is compatible with the internal device library revision.
The device moves into the powerup mode, returns the reply, and moves into the powerdown mode.
The POWER_UP command is sent to the device again to configure the mode of the device and additionally is used to start the patching process.
When applying the patch, the PATCH bit in ARG1 of the POWER_UP command must be set to 1 to begin the patching process. [AN332 (REV 1.0) page 219].
References SI4735::powerDown(), and SI4735::waitToSend().
Referenced by SI4735::loadPatch(), and SI4735::loadPatchNBFM().
void SI4735::patchPowerUp | ( | ) |
This method can be used to prepare the device to apply SSBRX patch.
Call queryLibraryId before call this method. Powerup the device by issuing the POWER_UP command with FUNC = 1 (AM/SW/LW Receive).
References SI4735::waitToSend().
Referenced by SI4735::loadPatch().
void SI4735::ssbPowerUp | ( | ) |
This function can be useful for debug and test.
References SI4735::waitToSend().
bool SI4735::downloadPatch | ( | const uint8_t * | ssb_patch_content, |
const uint16_t | ssb_patch_content_size | ||
) |
Transfers the content of a patch stored in a array of bytes to the SI4735 device.
You must mount an array as shown below and know the size of that array as well.
It is importante to say that patches to the SI4735 are distributed in binary form and have to be transferred to the internal RAM of the device by the host MCU (in this case Arduino). Since the RAM is volatile memory, the patch stored into the device gets lost when you turn off the system. Consequently, the content of the patch has to be transferred again to the device each time after turn on the system or reset the device.
The disadvantage of this approach is the amount of memory used by the patch content. This may limit the use of other radio functions you want implemented in Arduino.
Example of content:
ssb_patch_content | point to array of bytes content patch. |
ssb_patch_content_size | array size (number of bytes). The maximum size allowed for a patch is 15856 bytes |
bool SI4735::downloadCompressedPatch | ( | const uint8_t * | ssb_patch_content, |
const uint16_t | ssb_patch_content_size, | ||
const uint16_t * | cmd_0x15, | ||
const int16_t | cmd_0x15_size | ||
) |
Same downloadPatch.
Transfers the content of a patch stored in a compressed array of bytes to the SI4735 device.
ssb_patch_content | point to array of bytes content patch. |
ssb_patch_content_size | array size (number of bytes). The maximum size allowed for a patch is 15856 bytes |
cmd_0x15 | Array of lines where the first byte of each patch content line is 0x15 |
cmd_0x15_size | Array size |
void SI4735::loadPatch | ( | const uint8_t * | ssb_patch_content, |
const uint16_t | ssb_patch_content_size, | ||
uint8_t | ssb_audiobw = 1 |
||
) |
Loads a given SSB patch content.
Configures the Si4735-D60/SI4732-A10 device to work with SSB.
ssb_patch_content | point to patch content array |
ssb_patch_content_size | size of patch content |
ssb_audiobw | SSB Audio bandwidth; 0 = 1.2kHz (default); 1=2.2kHz; 2=3kHz; 3=4kHz; 4=500Hz; 5=1kHz. |
References SI4735::patchPowerUp(), and SI4735::queryLibraryId().
si4735_eeprom_patch_header SI4735::downloadPatchFromEeprom | ( | int | eeprom_i2c_address | ) |
Transfers the content of a patch stored in an eeprom to the SI4735 device.
To used this method, you will need an eeprom with the patch content stored into it.
This content have to be generated by the sketch SI47XX_09_SAVE_SSB_PATCH_EEPROM on folder TOOLS.
eeprom_i2c_address |