PU2CLR Si4735 Arduino Library 2.1.4
Arduino Library for Si47XX Devices - By Ricardo Lima Caratti
|
Single Side Band (SSB) implementation.
First of all, the SSB patch content is not part of this library. The patches used here were made available by Mr. Vadim Afonkin on his Dropbox repository. Please note that the author of this library does not encourage anyone to use the SSB patches content for commercial purposes. In other words, while this library supports SSB patches, the patches themselves are not a part of this library.
More...
Functions | |
uint16_t | SI4735::getAntennaTuningCapacitor () |
Get the Antenna Tuning Capacitor value. | |
void | SI4735::setAvcAmMaxGain () |
Sets the Avc Am Max Gain to maximum gain (0x7800) | |
void | SI4735::setAvcAmMinGain () |
Sets the Avc Am Max Gain to minimal gain (0x1000) | |
void | SI4735::setAvcAmDefaultGain () |
Sets the Avc Am Max Gain to default gain (0x2A80) | |
uint8_t | SI4735::getCurrentAvcAmMaxGain () |
Get the current Avc Am Max Gain. | |
void | SI4735::setAmSoftMuteMaxAttenuation (uint8_t smattn=0) |
Sets the Am Soft Mute Max Attenuation. | |
void | SI4735::setSsbSoftMuteMaxAttenuation (uint8_t smattn=0) |
Sets the SSB Soft Mute Max Attenuation object. | |
void | SI4735::setSsbIfAgcReleaseRate (uint8_t param=140) |
Sets the number of milliseconds the low IF peak detector. | |
void | SI4735::setSsbIfAgcAttackRate (uint8_t param=4) |
Sets the IF AGC attack rate. | |
void | SI4735::setSsbAgcAttackRate (uint16_t parameter) |
Sets the AGC attack rate on SSB mode. | |
void | SI4735::setSsbAgcReleaseRate (uint16_t parameter) |
Sets the AGC Release rate on SSB mode. | |
void | SI4735::setSBBSidebandCutoffFilter (uint8_t SBCUTFLT) |
void | SI4735::setSSBBfo (int offset) |
Sets the SSB Beat Frequency Offset (BFO). | |
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. | |
void | SI4735::setSSBDspAfc (uint8_t DSP_AFCDIS) |
Sets DSP AFC disable or enable. | |
void | SI4735::setSSBSoftMute (uint8_t SMUTESEL) |
Sets SSB Soft-mute Based on RSSI or SNR Selection: | |
void | SI4735::setSSBAutomaticVolumeControl (uint8_t AVCEN) |
Sets SSB Automatic Volume Control (AVC) for SSB mode. | |
void | SI4735::setSSBAvcDivider (uint8_t AVC_DIVIDER) |
Sets AVC Divider. | |
void | SI4735::setSSBSidebandCutoffFilter (uint8_t SBCUTFLT) |
Sets SBB Sideband Cutoff Filter for band pass and low pass filters. | |
void | SI4735::setSSBAudioBandwidth (uint8_t AUDIOBW) |
SSB Audio Bandwidth for SSB mode. | |
void | SI4735::setSSB (uint8_t usblsb) |
Set the radio to AM function. | |
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). | |
void | SI4735::getSsbAgcStatus () |
Queries SSB Automatic Gain Control STATUS. | |
void | SI4735::setSsbAgcOverrite (uint8_t SSBAGCDIS, uint8_t SSBAGCNDX, uint8_t reserved=0) |
Automatic Gain Control setup. | |
si47x_firmware_query_library | SI4735::queryLibraryId () |
Query the library information of the Si47XX device. | |
void | SI4735::patchPowerUp () |
This method can be used to prepare the device to apply SSBRX patch. | |
void | SI4735::ssbPowerUp () |
This function can be useful for debug and test. | |
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. | |
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) |
Deal with compressed SSB patch. | |
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. | |
void | SI4735::loadCompressedPatch (const uint8_t *ssb_patch_content, const uint16_t ssb_patch_content_size, const uint16_t *cmd_0x15, const int16_t cmd_0x15_size, uint8_t ssb_audiobw=1) |
Loads the SSB compressed patch content. | |
si4735_eeprom_patch_header | SI4735::downloadPatchFromEeprom (int eeprom_i2c_address) |
Transfers the content of a patch stored in an eeprom to the SI4735 device. | |
Single Side Band (SSB) implementation.
First of all, the SSB patch content is not part of this library. The patches used here were made available by Mr. Vadim Afonkin on his Dropbox repository. Please note that the author of this library does not encourage anyone to use the SSB patches content for commercial purposes. In other words, while this library supports SSB patches, the patches themselves are not a 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 is not necessarily correct.
A patch is executed internally (run by internal MCU) of the device. Usually, patches are used to fix bugs or add improvements and new features over what the firmware installed in the internal ROM of the device offers. Patches for the SI4735 are distributed in binary form and are 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 to the device every time the device is powered up.
I would like to thank Mr Vadim Afonkin for making the SSBRX patches available 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. The patch content of the original files is in hexadecimal format, stored in an ASCII text file. If you are not using C/C++ or if you want to load the files directly to the SI4735, you must convert the hexadecimal values to numeric values from 0 to 255. For example: 0x15 = 21 (00010101); 0x16 = 22 (00010110); 0x01 = 1 (00000001); 0xFF = 255 (11111111);
ATTENTION: The author of this project cannot guarantee that procedures shown here will work in your development environment. Proceed at your own risk. This library works with the I²C communication protocol to send an SSB extension PATCH to SI4735-D60 and SI4732-A10 devices. Once again, the author disclaims any and all liability for any damage or effects this procedure may have on your devices. Procced at your own risk.
|
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 stores the high byte of READANTCAP and the attribute READANTCAP by itself stores the low byte.
|
inline |
Sets the Avc Am Max Gain to maximum gain (0x7800)
|
inline |
Sets the Avc Am Max Gain to minimal gain (0x1000)
|
inline |
Sets the Avc Am Max Gain to default gain (0x2A80)
|
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 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 number of milliseconds the low IF peak detector.
Sets the number of milliseconds the low IF peak detector must not be exceeded before increasing the gain. Default value is 140 (approximately 40 dB / s).
param | number of milliseconds ( from 4 to 248; step 4); default value 0x008C (140). |
|
inline |
Sets the IF AGC attack rate.
Large values provide slower attack, and smaller values provide faster attack
param | number of milliseconds ( from 4 to 248; step 4); default value 4. |
|
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) |
|
inline |
SBCUTFLT |
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::setSSBSidebandCutoffFilter | ( | 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 150 and 30 MHz.
Via VFO you have 1kHz steps.
Via BFO you have 8Hz 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::setSSBAudioBandwidth(), SI4735::setSSBAutomaticVolumeControl(), SI4735::setSSBAvcDivider(), SI4735::setSSBConfig(), SI4735::setSSBDspAfc(), SI4735::setSSBSidebandCutoffFilter(), 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().
void SI4735::setSsbAgcOverrite | ( | uint8_t | SSBAGCDIS, |
uint8_t | SSBAGCNDX, | ||
uint8_t | reserved = 0 |
||
) |
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::loadCompressedPatch(), 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::loadCompressedPatch(), and 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.
Patches for the SI4735 are distributed in binary form and are 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 on the device gets lost when you turn off the system. Consequently, the content of the patch has to be transferred to the device every time the device is powered up.
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 | ||
) |
Deal with compressed SSB patch.
It works like the downloadPatch method but requires less memory to store the patch.
Transfers the content of a patch stored in a compressed array of bytes to the SI4735 device.
In the patch_init.h and patch_full.h files, the first byte of each line begins with either a 0x15 or 0x16 value
To shrink the original patch size stored on the master MCU (Arduino), the first byte
is omitted and a new array is added to indicate which lines begin with the value 0x15.
For the other lines, the downloadCompressedPatch method will insert the value 0x16.
The value 0x16 occurs on most lines in the patch. This approach will save about 1K of memory.
The example code below shows how to use compressed SSB patch.
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().
void SI4735::loadCompressedPatch | ( | const uint8_t * | ssb_patch_content, |
const uint16_t | ssb_patch_content_size, | ||
const uint16_t * | cmd_0x15, | ||
const int16_t | cmd_0x15_size, | ||
uint8_t | ssb_audiobw = 1 |
||
) |
Loads the SSB compressed 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 |
cmd_0x15 | Array of lines where the first byte of each patch content line is 0x15 |
cmd_0x15_size | Array size |
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 |
References SI4735::waitToSend().