PU2CLR Si4735 Arduino Library 2.1.4
Arduino Library for Si47XX Devices - By Ricardo Lima Caratti
|
Functions | |
void | SI4735::setPowerUp (uint8_t CTSIEN, uint8_t GPO2OEN, uint8_t PATCH, uint8_t XOSCEN, uint8_t FUNC, uint8_t OPMODE) |
Set the Power Up parameters for si473X. | |
void | SI4735::radioPowerUp (void) |
Powerup the Si47XX. | |
void | SI4735::analogPowerUp (void) |
You have to call setPowerUp method before. | |
void | SI4735::powerDown (void) |
Moves the device from powerup to powerdown mode. | |
void | SI4735::getFirmware (void) |
Gets firmware information. | |
void | SI4735::setRefClock (uint16_t refclk) |
Sets the frequency of the REFCLK from the output of the prescaler. | |
void | SI4735::setRefClockPrescaler (uint16_t prescale, uint8_t rclk_sel=0) |
Sets the number used by the prescaler to divide the external RCLK down to the internal REFCLK. | |
void | SI4735::setup (uint8_t resetPin, uint8_t ctsIntEnable, uint8_t defaultFunction, uint8_t audioMode=SI473X_ANALOG_AUDIO, uint8_t clockType=XOSCEN_CRYSTAL, uint8_t gpo2Enable=0) |
Starts the Si473X device. | |
void | SI4735::setup (uint8_t resetPin, uint8_t defaultFunction) |
Starts the Si473X device. | |
void SI4735::setPowerUp | ( | uint8_t | CTSIEN, |
uint8_t | GPO2OEN, | ||
uint8_t | PATCH, | ||
uint8_t | XOSCEN, | ||
uint8_t | FUNC, | ||
uint8_t | OPMODE | ||
) |
Set the Power Up parameters for si473X.
Use this method to chenge the defaul behavior of the Si473X. Use it before PowerUp()
About the parameter XOSCEN:
0 = Use external RCLK (crystal oscillator disabled);
1 = Use crystal oscillator (RCLK and GPO3/DCLK with external 32.768 kHz crystal and OPMODE = 01010000).
uint8_t | CTSIEN sets Interrupt anabled or disabled (1 = anabled and 0 = disabled ) |
uint8_t | GPO2OEN sets GP02 Si473X pin enabled (1 = anabled and 0 = disabled ) |
uint8_t | PATCH Used for firmware patch updates. Use it always 0 here. |
uint8_t | XOSCEN sets external Crystal enabled or disabled. 0 = Use external RCLK (crystal oscillator disabled); 1 = Use crystal oscillator |
uint8_t | FUNC sets the receiver function have to be used [0 = FM Receive; 1 = AM (LW/MW/SW) and SSB (if SSB patch apllied)] |
uint8_t | OPMODE set the kind of audio mode you want to use. |
void SI4735::radioPowerUp | ( | void | ) |
Powerup the Si47XX.
Before call this function call the setPowerUp to set up the parameters.
Parameters you have to set up with setPowerUp
Parameter | Description |
---|---|
CTSIEN | Interrupt anabled or disabled |
GPO2OEN | GPO2 Output Enable or disabled |
PATCH | Boot normally or patch |
XOSCEN | 0 (XOSCEN_RCLK) = external active crystal oscillator. 1 (XOSCEN_CRYSTAL) = passive crystal oscillator; |
FUNC | defaultFunction = 0 = FM Receive; 1 = AM (LW/MW/SW) Receiver |
OPMODE | SI473X_ANALOG_AUDIO (B00000101) or SI473X_DIGITAL_AUDIO (B00001011) |
ATTENTION: The document AN383; "Si47XX ANTENNA, SCHEMATIC, LAYOUT, AND DESIGN GUIDELINES"; rev 0.8; page 6; there is the following note: Crystal and digital audio mode cannot be used at the same time. Populate R1 and remove C10, C11, and X1 when using digital audio.
References SI4735::setHardwareAudioMute(), and SI4735::waitToSend().
Referenced by SI4735::analogPowerUp(), SI4735::setAM(), SI4735::setFM(), SI4735::setNBFM(), SI4735::setSSB(), and SI4735::setup().
void SI4735::analogPowerUp | ( | void | ) |
You have to call setPowerUp method before.
This function is still available only for legacy reasons. If you are using this function, please, replace it by radioPowerup().
References SI4735::radioPowerUp().
void SI4735::powerDown | ( | void | ) |
Moves the device from powerup to powerdown mode.
After Power Down command, only the Power Up command is accepted.
References SI4735::setHardwareAudioMute(), and SI4735::waitToSend().
Referenced by SI4735::queryLibraryId(), SI4735::setAM(), and SI4735::setFM().
void SI4735::getFirmware | ( | void | ) |
Gets firmware information.
The firmware information will be stored in firmwareInfo member variable
References SI4735::waitToSend().
Referenced by SI4735::setup().
void SI4735::setRefClock | ( | uint16_t | refclk | ) |
Sets the frequency of the REFCLK from the output of the prescaler.
The REFCLK range is 31130 to 34406 Hz (32768 ±5% Hz) in 1 Hz steps, or 0 (to disable AFC). For example, an RCLK of 13 MHz would require a prescaler value of 400 to divide it to 32500 Hz REFCLK.
The reference clock frequency property would then need to be set to 32500 Hz.
RCLK frequencies between 31130 Hz and 40 MHz are supported, however, there are gaps in frequency coverage for prescaler values ranging from 1 to 10, or frequencies up to 311300 Hz. See table below.
Table REFCLK Prescaler
Prescaler | RCLK Low (Hz) | RCLK High (Hz) |
---|---|---|
1 | 31130 | 34406 |
2 | 62260 | 68812 |
3 | 93390 | 103218 |
4 | 124520 | 137624 |
5 | 155650 | 172030 |
6 | 186780 | 206436 |
7 | 217910 | 240842 |
8 | 249040 | 275248 |
9 | 280170 | 309654 |
10 | 311300 | 344060 |
refclk | The allowed REFCLK frequency range is between 31130 and 34406 Hz (32768 ±5%), or 0 (to disable AFC). |
void SI4735::setRefClockPrescaler | ( | uint16_t | prescale, |
uint8_t | rclk_sel = 0 |
||
) |
Sets the number used by the prescaler to divide the external RCLK down to the internal REFCLK.
The range may be between 1 and 4095 in 1 unit steps.
For example, an RCLK of 13 MHz would require a prescaler value of 400 to divide it to 32500 Hz. The reference clock frequency property would then need to be set to 32500 Hz.
ATTENTION by default, this function assumes you are using the RCLK pin as clock source.
Example: The code below shows the setup for an active 4.9152MHz crystal
Example: The code below shows the setup for an active 13MHz crystal
prescale | Prescaler for Reference Clock value; Between 1 and 4095 in 1 unit steps. Default is 1. |
rclk_sel | 0 = RCLK pin is clock source (default); 1 = DCLK pin is clock source |
void SI4735::setup | ( | uint8_t | resetPin, |
uint8_t | ctsIntEnable, | ||
uint8_t | defaultFunction, | ||
uint8_t | audioMode = SI473X_ANALOG_AUDIO , |
||
uint8_t | clockType = XOSCEN_CRYSTAL , |
||
uint8_t | gpo2Enable = 0 |
||
) |
Starts the Si473X device.
Use this function to start the device up with the parameters shown below.
If the audio mode parameter is not entered, analog mode will be considered.
You can use any Arduino digital pin. Be sure you are using less than 3.6V on Si47XX RST pin.
ATTENTION: The document AN383; "Si47XX ANTENNA, SCHEMATIC, LAYOUT, AND DESIGN GUIDELINES"; rev 0.8; page 6; there is the following note: Crystal and digital audio mode cannot be used at the same time. Populate R1 and remove C10, C11, and X1 when using digital audio.
resetPin | Digital Arduino Pin used to RESET de Si47XX device. |
ctsIntEnable | CTS Interrupt Enable. |
defaultFunction | is the mode you want the receiver starts. |
audioMode | default SI473X_ANALOG_AUDIO (Analog Audio). Use SI473X_ANALOG_AUDIO or SI473X_DIGITAL_AUDIO. |
clockType | 0 = Use external RCLK (crystal oscillator disabled); 1 = Use crystal oscillator |
gpo2Enable | GPO2OE (GPO2 Output) 1 = Enable; 0 Disable (defult) |
References SI4735::getFirmware(), SI4735::radioPowerUp(), SI4735::reset(), and SI4735::setHardwareAudioMute().
void SI4735::setup | ( | uint8_t | resetPin, |
uint8_t | defaultFunction | ||
) |
Starts the Si473X device.
Use this setup if you are not using interrupt resource.
If the audio mode parameter is not entered, analog mode will be considered.
You can use any Arduino digital pin. Be sure you are using less than 3.6V on Si47XX RST pin.
uint8_t | resetPin Digital Arduino Pin used to RESET command. |
uint8_t | defaultFunction. 0 = FM mode; 1 = AM |