background image

Disclaimer

Silicon Laboratories intends to provide customers with the latest, accurate, and in-depth documentation of all peripherals and modules available for system and software implementers 

using or intending to use the Silicon Laboratories products. Characterization data, available modules and peripherals, memory sizes and memory addresses refer to each specific 

device, and "Typical" parameters provided can and do vary in different applications. Application examples described herein are for illustrative purposes only. Silicon Laboratories 

reserves the right to make changes without further notice and limitation to product information, specifications, and descriptions herein, and does not give warranties as to the accuracy 

or completeness of the included information. Silicon Laboratories shall have no liability for the consequences of use of the information supplied herein. This document does not imply 

or express copyright licenses granted hereunder to design or fabricate any integrated circuits. The products must not be used within any Life Support System without the specific 

written consent of Silicon Laboratories. A "Life Support System" is any product or system intended to support or sustain life and/or health, which, if it fails, can be reasonably expected 

to result in significant personal injury or death. Silicon Laboratories products are generally not intended for military applications. Silicon Laboratories products shall under no 

circumstances be used in weapons of mass destruction including (but not limited to) nuclear, biological or chemical weapons, or missiles capable of delivering such weapons.

Trademark Information

Silicon Laboratories Inc., Silicon Laboratories, Silicon Labs, SiLabs and the Silicon Labs logo, CMEMS®, EFM, EFM32, EFR, Energy Micro, Energy Micro logo and combinations 

thereof, "the world’s most energy friendly microcontrollers", Ember®, EZLink®, EZMac®, EZRadio®, EZRadioPRO®, DSPLL®, ISOmodem ®, Precision32®, ProSLIC®, SiPHY®, 

USBXpress® and others are trademarks or registered trademarks of Silicon Laboratories Inc. ARM, CORTEX, Cortex-M3 and THUMB are trademarks or registered trademarks of 

ARM Holdings. Keil is a registered trademark of ARM Limited. All other products or brand names mentioned herein are trademarks of their respective holders. 

http://www.silabs.com

Silicon Laboratories Inc.

400 West Cesar Chavez

Austin, TX 78701

USA

Simp

li

city Studio

One-click access to MCU tools, 

documentation, software, source 

code libraries & more. Available 

for Windows, Mac and Linux!

www.silabs.com/simplicity

MCU Portfolio

www.silabs.com/mcu

SW/HW

www.silabs.com/simplicity

Quality

www.silabs.com/quality

Support and Community

community.silabs.com

Summary of Contents for Si4010 Series

Page 1: ...ice programming level is Factory or User For those levels the C2 debugging interface is enabled after the boot by a boot routine The device has been disconnected from the Silicon Labs IDE The disconnected means in a software sense not physically using the Connect Disconnect buttons on IDE Or the device is running the User code automatically after the boot without ever being connected to the IDE Th...

Page 2: ...AN370 2 Rev 1 0 ...

Page 3: ...em Impact of Some Functions 22 6 1 Interrupt Priorities 22 6 2 Interrupt Enable Control 23 6 3 System Clock Control 24 6 4 Transmission Chain Control 25 6 5 Infinite Loops 27 7 Module Descriptions 28 7 1 AES Module 28 7 2 Button Service Module and Master Time 31 7 3 Demodulator Temperature Sensor Module 42 7 4 Encoding Module 48 7 5 Frequency Counter Module 53 7 6 Frequency Casting Module 56 7 7 H...

Page 4: ...x4000 through 0x40FF More information on XREGs can be found in the Si4010 data sheet This is not a recognized Keil compiler keyword ROM Read only memory containing all the API functions Residing at CODE addresses 0x8000 through 0xAFFF The CPU executes ROM code directly ROM is not readable by the user application NVM Non Volatile Memory Each bit can only be written as 1 once One Time Programmable O...

Page 5: ... accessible as data but the code residing in ROM can be executed The NVM is virtually mapped into this region but is not directly accessible by CPU The NVM API functions must be used to access the NVM Figure 2 Si4010 Unified CODE XDATA Memory Organization Indirect addressing only by Ri pointers DATA IDATA SFR DATA 0x00 0x7F 0x80 0xFF 0x80 0xFF MOV A Ri Direct addressing only MOV A addr Both direct...

Page 6: ...not overwrite the Factory and Boot XDATA region during runtime There is no hardware protection of that region so it is up to the customer discipline not to place any CODE nor XDATA variables If that happens the behavior of the chip becomes unpredictable 3 4 DATA IDATA Internal Memory Reserved Area Portions of the 8051 MCU internal memory are also used by ROM API code The following diagram shows DA...

Page 7: ...R7 of the currently selected bank API functions use the register bank currently selected by the user application The API functions do not access RB0 directly User is free to choose any register bank for main application and any register bank for interrupt service routines API Reserved 16B 0x20 Registers RB1 RB3 Available 24B Bit Addr Available 16B 0x2F 0x30 0x3F DATA IDATA MCU Internal RAM DATA lo...

Page 8: ...function variables are also prefixed accordingly In addition to the prefixes for the basic types in the table in section 4 1 the following prefixes are used The dot in the prefix specification means that the letter cannot stand on its own and must be preceded or succeeded by another prefix letter or letters Type Bit Width Type Definition Prefix unsigned char 8 BYTE b unsigned int 16 WORD w unsigne...

Page 9: ...IDATA internal memory at a BYTE b The area pointed to is both input to the function and is modified by the function io Module Prefix Module Name Aes AES Bsr Button service routine DmdTs Temperature sensor and its demodulator Enc Encoding of data for transmission Fc Frequency counter FCast Frequency casting and fine tuning Hvram HVRAM Mtp MTP EEPROM memory MVdd Battery VDD measurement Nvm NVM memor...

Page 10: ...n they take precedence over the actual library provided by the toolchain then it is necessary to use si4010_rom_all a51 instead of the Keil specific toolchain during the application building C ULSHR C LSHL C OFFXADD C FPSUB C FPADD C FPMUL C FCASTL C FCASTC C FCASTI C CASTF C FPGETOPN2 C FPNANRESULT C FPOVERFLOW C FPRESULT C FPRESULT2 C FPUNDERFLOW C LNEG C LLDIDATA C LLDXDATA C LLDIDATA0 C LLDXDA...

Page 11: ...he application using two levels of interrupt levels and lower priority ISR was interrupted by the higher priority ISR The user is required to leave at least additional 4 bytes of stack space 2 bytes as a guard and 2 bytes for possible Silicon Labs use in the future Table 1 Additional Stack Requirements Function Internal stack use bytes vAes_Cipher 3 vAes_InvCipher 3 vAes_InvGenKey 3 wBsr_Pop vBsr_...

Page 12: ...ne 4 lSleepTim_GetCount 2 vSleepTim_SetCount 2 bSleepTim_CheckDutyCycle 4 vSleepTim_AddTxTimeToCounter 4 lSleepTim_GetOneHourValue vStl_EncodeSetup vStl_SingleTxLoop 6 vStl_PreLoop 6 vStl_PostLoop 2 bStl_EncodeByte 2 vSys_BandGapLdo 2 bSys_GetRevId lSys_GetProdId bSys_GetBootStatus vSys_SetClkSys vSys_Setup lSys_GetMasterTime 2 vSys_IncMasterTime 2 vSys_SetMasterTime vSys_LedIntensity vSys_Shutdow...

Page 13: ...in application function can be interrupted by single ISR and any ISR can get interrupted by higher priority interrupt It also assumes that the user is compiling the ISR routine with using directive The calculation assumes that the vFCast_Tune is called either from the main application or from ISR but not both 2 call to ROM function 8 API worst case above 2 interrupt return address 5 for ISR routin...

Page 14: ...o reflect the change 4 5 Hardware Thread Safety Almost all of the API functions access hardware If the function accessing the same hardware is going to be used in the main application and in the interrupt service routine ISR then there is a conflict There are no semaphores nor any hardware access protections implemented in the API routines From hardware point of view the API functions should be tr...

Page 15: ... example If the registers required by subsequent parameters are taken by the previous arguments then the subsequent arguments cannot be passed in the registers For example passing two long variables in registers is not possible Similarly passing long first and int second is not possible while passing int first and int second is possible Function return values are always passed in registers Note th...

Page 16: ...ROM symbol map that must be assembled and linked into the application build if the API functions are being used It tells the linker the API functions are located in ROM This file is tailored to Keil toolchain It also includes references to some of the Keil library functions si4010_rom_all a51 Same as above but for any other toolchain It can also be used with Keil toolchain if the user does not des...

Page 17: ...IELD NAME field low significant bit index For example ODS_TIMING 0xaa define M_ODS_CK_DIV 0x07 field mask defines define M_ODS_EDGE_TIME 0x18 define M_ODS_GROUP_WIDTH 0xe0 define B_ODS_CK_DIV 0 base bit index defines define B_ODS_EDGE_TIME 3 define B_ODS_GROUP_WIDTH 5 The define statements were added for convenience to initialize or modify the single and multi bit fields inside of the registers Fo...

Page 18: ... startup a51 can be modified not to include stack pointer setting using a stack segment Then the user will have to set the stack pointer manually to a fixed location in startup a51 or at the beginning of the application The following shows linker command line directives to place a stack manually using the address 0x80 as an example For Keil BL51 STACK STACK 0x80 For Keil LX51 SEGMENTS STACK I 0x80...

Page 19: ...content of wBoot_DpramTrimBeg residing at the address 0x11F3 The variable content is directly accessible from the Silicon Labs IDE View Debug Windows Si4010 System Vars It is critical that neither user CODE nor user XDATA will encroach on that space For example the currently shipped version of the chip has the value wBoot_DpramTrimBeg 0x1080 Therefore as an example that user needs to reserve 64 by...

Page 20: ... The construct is a wait the first valid DMD ISR sample to be generated by the DMD ISR while 0 bDmdTx_GetSamplesTaken All functions from the DMD TS module with module prefix DmdTs_ also require the DMD ISR to be present in the system The user is free to use the using directive when defining ISR functions The downside of not using the using directive when defining an ISR is that when the ISR is inv...

Page 21: ...o the demodulator and temperature sensor Use RB1 system is using single interrupt priority level for all ISR s Use RB2 system is using two interrupt priority levels This DMD ISR must be always at the higher priority level in the system VARIABLES Clear the demodulator interrupt flag vDmdTs_ClearDmdIntFlag Call DMD TS function that handles skipping samples and getting the sample from the temperature...

Page 22: ...er there is another requirement related to the ISR priority levels The DMD ISR must be at the higher interrupt priority level than any function or ISR calling the following functions or which includes the software construct below The items are the same as listed in the DMD ISR description section above Functions which must be interruptible by the DMD ISR vFCast_Tune vSys_LpOscAdj vStl_PreLoop vStl...

Page 23: ...portions of the code See function description for details iMVdd_Measure S 1 R 1 0 Needs DMD TS interrupt service to run It forcibly enables the DMD interrupt and then disables it User needs to re enable the EDMD 1 if that was the previous state vStl_PostLoop 0 It also forces EODS 0 but the ODS interrupt is not currently used by API Calling Direct Functions vFCast_Tune 1 1 From vDmdTs_RunForTemp vS...

Page 24: ...s should not rely on the user specified clock frequency If the user ISR routines rely on the user set system frequency they need to check the value of the SYSGEN_DIV field inside of ISR and act accordingly There are functions which force the system clock frequency directly and then functions which force it indirectly by calling the direct manipulation functions Table 3 shows the system clock contr...

Page 25: ...he state of LC DIV and PA Table 4 Transmission Chain Control Functions Function LC DIV PA Notes Functions vFCast_Tune 1 1 0 Leaves the LC forcibly on Assumes that the ODS is disabled vPa_Tune 1 0 1 0 1 0 Calls vSys_ForceLc forces all on and then clears the forced on bits Assumes that the ODS is disabled vOds_Enable Enable Disable ODS for data transmission vStl_PreLoop 1 1 1 1 Calls vSys_ForceLc bu...

Page 26: ... the fact that the ODS is enabled 1 or disabled 0 The values without denote the forced block enable values controlled by the ODS_CTRL bits S 1 R Save the original setting upon entry force value to 1 for function processing then restore the original value before return 1 Set the forced block enable value to 1 1 Set the forced block enable value to 1 depending on some other device setting 1 Block en...

Page 27: ... times DMD TS ISR Note 1 vStl_PostLoop ODS_NODATA ODS_EMPTY ODS functioning vOds_Enable 0 2 vFCast_Tune FC_DONE 5 times FC f_count f_int present FC_DONE 1 Temp samples 0 DMD TS ISR Note 3 XO_CKGOOD if XO_ENA 1 XO functioning if XO_ENA 1 No remedy4 Notes 1 The DMD TS must be running and the DMD TS ISR must be present in the system and functional and processing samples otherwise the whole system is ...

Page 28: ...crypt decrypt operation so the user must copy a new key to the predefined DATA IDATA key location before each vAes_Cipher vAes_InvGenKey or vAes_InvCipher call The ordering of the key and data is the usual ordering expected by byte oriented AES implementation For reference here is one commonly used example BYTE abPlainData 16 0x32 0x43 0xf6 0xa8 0x88 0x5a 0x30 0x8d 0x31 0x31 0x98 0xa2 0xe0 0x37 0x...

Page 29: ...a contents have been encrypted pbioRoundKey pointer to IDATA BYTE The original key gets destroyed vAes_InvGenKey Description Given the last key used in the encryption process this function calculates the starting key for the decryption process It must be called before the vAes_InvCipher to prepare the decryption key if only the cipher encryption key is available Inputs pbioRoundKey pointer to IDAT...

Page 30: ...ter to a byte which is the first byte in an array of 16 bytes This array contains the key to be used for the AES decryp tion The key gets destroyed during the operation Outputs pbioState pointer to IDATA BYTE Pointer to a byte which is the first byte in an array of 16 bytes This pointer is pointing to the same memory location as the input version but now the 16 byte data contents have been decrypt...

Page 31: ...r for it It is up to the user application to call the vBsr_Service at a rate the user wants to sample buttons Every call to vBsr_Service samples the button input GPIOs Note It is fully up to the user application to implement mechanism to call the vBsr_Service routine in a periodic fashion in time The user is free to use the real time clock RTC timer for invoking interrupt or any of the two generic...

Page 32: ... system variable implemented as a LWORD 32 bit unsigned number It is accessed by 3 API functions vSys_SetMasterTime initializes the master time variable vSys_IncMasterTime adds user specified value to it lSys_GetMasterTime returns the current value of the master time The vBsr_Service function calls the lSys_GetMasterTime function It is fully up to the user application to setup the master time One ...

Page 33: ...hould call the bBts_GetPtsItemCount again to determine whether the button press status changed If the PTS FIFO is still empty that means that the original button situation has not changed and the application therefore concludes that the button is still being pressed If that happens application could call bBsr_GetTimestamp function and compare the original button press timestamp with the current ti...

Page 34: ...k 1 B_GPIO1 1 B_GPIO2 rBsrSetup pbPtsReserveHead BYTE arPtsArray rBsrSetup bPtsSize bPtsSize_c rBsrSetup bPushQualThresh 3 3 same consecutive samples to qualify Setup the BSR vBsr_Setup rBsrSetup Setup the RTC to tick every 5ms and clear it Keep it disabled RTC_CTRL 0x07 B_RTC_DIV M_RTC_CLR Enable the RTC RTC_CTRL M_RTC_ENA Enable the RTC interrupt and global interrupt enable ERTC 1 EA 1 Waiting f...

Page 35: ...d interrupt INTERRUPT_RTC using 1 Use RB1 for ISR FUNCTION DESCRIPTION This is the interrupt service routine for RTC VARIABLES Clear the RTL interrupt flag RTC_CTRL M_RTC_INT Since we are ticking at 5ms add 5 to the master time to keep master time units as ms vSys_IncMasterTime 5UL ...

Page 36: ...AN370 36 Rev 1 0 Sample the input buttons is uses the master time for timestamp vBsr_Service ...

Page 37: ...the associated GPIO input changes are ignored pbPtsReserveHead Pointer to BYTE in XDATA Pointer to head of array of bytes declared by applica tion to reserve space for the PTS The array of bytes is actually an array of the tBsr_PtsElement types bPtsSize BYTE The depth of the PTS FIFO in button pushes struc tures of tBsr_PtsElement type or the number of qualified button pushes to be stored at any o...

Page 38: ...byte and the button vector in the LSB byte effectively returning the tBsr_PtsEle ment type structure in a WORD variable The button vector and timestamp represent the oldest qualified button push in the PTS When there are 0 elements in the PTS this func tion will return 0 This function also advances the read pointer to the next element in the PTS removing the currently returned button from informat...

Page 39: ... was full The user can use this function to skip over the FIFO content to look ahead what the latest qualified state of the buttons is The user still needs to check whether the FIFO has any items in it Inputs None Outputs Button vector and timestamp WORD Upper byte of the word is the timestamp byte The Lower byte of word is the button vector Effectively it is a structure of type tBsr_PtsElement pa...

Page 40: ...iption Returns the number of items in the PTS Each item in the PTS FIFO rep resents a button status change push or release Inputs None Outputs PTS item count BYTE The number of elements in the PTS Each element rep resents a button push release ...

Page 41: ...r application to call this function periodically whenever the input button states need to be sampled Inputs None Outputs None bBsr_GetTimestamp Description Returns lSys_GetMasterTime 32 timestamp value Inputs None Outputs Timestamp BYTE Timestamp value It is used internally to determine when but ton push release occurred to store it in the PTS If application wants to know how long ago that happene...

Page 42: ...r which is used by application code to determine if a new sample is ready The sample count can be acquired via the function bDmdTs_GetSamplesTaken Upon entry the function records the current value of the EA global interrupt enable bit disable all interrupts by setting EA 0 Then it does its own processing and just before return it puts the EA back to the state the function was entered with The glob...

Page 43: ...o point at 25degC e g value 1100 corresponds to 30degC This value is only for API internal use and is not calibrated for accurate ambient temperature measure ment vDmdTs_ClearDmd Description Clears the temperature sensor demodulator hardware Inputs None Outputs None vDmdTs_ClearDmdIntFlag Description Clears the temperature sensor demodulator interrupt flag Inputs None Outputs None ...

Page 44: ...ped then it calls iDmdTs_GetData and stores the returned value in the local variable The stored value of the latest sample can be accessed by calling the functions iDmdTs_GetLat estDmdSample to get the raw sample or iDmdTs_GetLatestTemp to get the sample converted to temperature in internal units Inputs None Outputs None bDmdTs_GetSamplesTaken Description Returns the number of valid not skipped sa...

Page 45: ...re mode This is the recommended function for the user to set up enable and run the temperature measurement This function needs to be run only once to enable the TS and DMD It calls vDmdTs_Setup and vDmdTs_Enable function It clears and sets up the demod ulator and temperature sensor from scratch The application using this function must include the DMD ISR in order for the application to work proper...

Page 46: ...iSampleSkipCount BYTE Parameter passed to the vDmdTs_Setup function It represents the number of output samples to skip before collecting values in the function vDmdTs_IsrCall Upon startup the output of the demodulator is not valid for about 3 samples biSampleSkipCount allows for configuration of how many samples needs to be skipped Do not use value less than 3 Outputs None ...

Page 47: ...es Disable the DMD TS interrupt Make sure that each interrupt disable is followed by at least 2 byte instruction EDMD 0 EDMD 0 Wasteful but no need to inspect the assembly Disable the DMD and TS to save power vDmdTs_Enable 0 Restart the DMD TS for temperature measurement vDmdTs_RunForTemp 3 Skip first 3 samples Inputs biSampleSkipCount BYTE number of output samples to skip before collecting values...

Page 48: ...LSb is fed to the PA first in the ODS To set ODS to shift all 8 bits of the byte to PA the user must set the tOds_Setup bGroupWidth 7 when calling the vOds_Setup function It is also possible that the user prepares the raw data first and requires that for example only 6 LSb bits will be transmitted for each byte In that case the value tOds_Setup bGroupWidth 6 1 has to be used when calling the vOds_...

Page 49: ...p function with the input structure tOds_Setup bGroupWidth 4 value to transmit all 5 bits in the converted output byte The vEnc_4b5bEncode function uses a global BYTE variable to remember the last bit of the previously encoded 5 bit symbol It updates the value each time it is called For the first symbol in a sequence the function vEnc_Set4b5bLastBit must be called to set this variable for use by i...

Page 50: ...ted array pointed at by pboEncodedBytes pointer need to be used The ODS serializer takes the encoded byte and starts transmitting pboEn codedBytes 0 byte the bit 0 first followed by bit 1 etc The bits are therefore transmitted in a little endian fashion When using custom encoding the user is responsible for calling the vOds_Setup function with the input structure tOds_Setup bGroupWidth value corre...

Page 51: ...4b5bEncode Description The function 4b5b encodes a byte into two bytes Each byte contains the 5 bit encoded result of the corresponding nibble from the input byte The bits are encoded in the little endian fashion Prior to calling this function for the first time per transmitted frame the vEnc_Set4b5bLastBit must be called to set the initial value of the last bit that the 4b5b encoding references T...

Page 52: ...d results in two bits Note that the bit 0 of the input byte is converted to the bits 0 and 1 of the pboEncodedBytes 0 byte The bit 7 of the input byte is converted to the bits 6 and 7 of the pboEncodedBytes 1 The bits are therefore converted in the little endian fashion The ODS will process the pbo EncodedByte array such that the bit 0 of the byte pboEncodedBytes 0 will get transmitted first etc I...

Page 53: ...e counter mode and divider selector The counter mode is essentially the interval clock source The table describes the purpose of each bit in this input parameter Table 9 Frequency Counter Terms Term Definition Counter mode Determined by the source for the interval clock Interval Number of interval clock cycles during which divider clock cycles are counted Divider clock Input clock which is counted...

Page 54: ...owing Ninterval_cycles 2 1 28 768 Outputs None vFc_StartCount Description Starts the frequency counter Inputs None Outputs None vFc_PollDone Description Polls the frequency counter busy flag and waits until the counter is done To be called after starting the frequency counter Note that if something happens in hardware loss of the interval clock for example and the frequency counter stalls and does...

Page 55: ...f the frequency counter Inputs None Outputs Frequency Count LWORD Current frequency count lFc_StartPollGetCount Description A combination of vFc_StartCount vFc_PollDone and lFc_GetCount After calling vFc_Setup this function can be called and will return the current frequency count after the counter stopped counting This is the recommended function for the user to perform a frequency count operatio...

Page 56: ...ructure of this type is used as an input to the vFCast_Xo Setup function The following table lists the members belonging to the tFCast_XoSetup structure 7 6 2 Frequency Casting Module Functions vFCast_Setup Description Frequency casting initialization This function should only be called only once per boot It is to be called prior to any calls to vFCast_Tune Once called the fre quency casting is in...

Page 57: ... while the device is going through the boot process to save time in the main application See bit4 of SFR PROT3_CTRL in the Si4010 data sheet and the corresponding XO Early Enable checkbox on the NVM programmer GUI The user can turn the XO on and off as required by for example using the following C code bXO_CTRL M_XO_ENA Turning the XO off bXO_CTRL M_XO_ENA Turning the XO on Inputs priXoSetup point...

Page 58: ...function vDmdTs_Run ForTemp Therefore after vFCast_Tune completes the user can retrieve the tempera ture readings as shown in the vDmdTs_RunForTemp description above There is no need for any further DMD setup the vFCast_Tune function does it The function also forces the LC oscillator on and leaves it turned on since this function should be followed by a call to vPa_Tune for antenna tuning where th...

Page 59: ... and apply it vFCast_FineTune iDmdTs_GetLatestTemp Inputs iiCurrentTemp int Signed output representing temperature in internal tempera ture units 220 bits degC It is the output of the iDmdTs_GetLatestTemp function Outputs None vFCast_FskAdj Description Takes the desired FSK deviation and adjusts the actual FSK deviation needed based on the results of frequency casting It is to be called after each...

Page 60: ...VRAM address Inputs biWriteAddr BYTE HVRAM address to write to Only bottom 3 bits are used the rest is ignored biWriteData BYTE Byte to be written Outputs None cbHvram_Read Description Reads data byte from the specified HVRAM address Inputs biReadAddr BYTE HVRAM address to read from Only bottom 3 bits are used the rest is ignored Outputs Read Data BYTE Data that resulted from the HVRAM read Table ...

Page 61: ... 2 Working with MTP The user can choose not to use the balanced counters as implemented by API The user is free to work with any bit in the MTP memory Given the asymmetric nature of the MTP there are rules the user should follow to work with MTP raw data 1 Any bit in the MTP can change state only up to 50 000 times Since during programming all the bits which are not being changed have to be put ba...

Page 62: ...sitive In general the MTP programming process will produce unpredictable results if interrupted even possibly damaging the MTP memory The function stores the original EA bit value upon entry and disables all the interrupts by setting EA 0 around critical parts of the code Since the programming of the MTP takes about 9 ms and can go up to 40 ms in some cases for some application having interrupts c...

Page 63: ...ues 3 through 6 Outputs Counter value LWORD Decoded value of the counter stored at the specified index vMtp_IncCount Description Increments by one the value of the counter starting at the specified byte index in the MTP The user must call the pbMtp_Read first before working with this function This function does not write the incremented value into the actual MTP In order to write the incremented v...

Page 64: ...e function in registers only biIndex BYTE Starting byte index of the desired counter in the MTP array Rec ommended values 0 4 8 12 biNibbleCnt BYTE Width of the counter see biNibbleCnt table above Valid values 3 through 6 Outputs None bMtp_Write Description The function writes all 128 bits of the global XDATA RAM array into the MTP It is highly recommended that all interrupts be disabled before ca...

Page 65: ...ecommended value is 40 The user should not use value bigger than 50 or smaller than 15 Outputs Status BYTE MTP programming status 0 Success MTP programmed correctly 1 Error Maximum user specified number of MTP programming cycles reached before MTP reported that all bits were programmed cor rectly vMtp_Strobe Description This function strobes the MTP to read the contents from the MTP into the XDATA...

Page 66: ...XDATA to the head of the internal RAM array This function calls the vMtp_Strobe function to latch the internal MTP content to its output registers All functions working with the balanced counters as well as the abMtp_Write function works on this internal XDATA RAM array Inputs None Outputs MTP RAM byte array pointer pointer to BYTE in XDATA Pointer to a byte array in XDATA where the abMTP_RDATA 16...

Page 67: ...upon entering the function 4 Measure the unloaded battery voltage 5 Only if biWait 0 make a loaded battery measurement 6 Remember the current system clock speed and switch the system clock to slower pace 7 Remember the current state of PA DIV divider and LC oscillator 8 Forcibly enable PA DIV and LC oscillator Note that even though the PA is enabled there is no RF power radiated to the antenna The...

Page 68: ...ther the Step F11 nor Multiple Step toolbar but tons when stepping over this function Inputs biWait BYTE Wait in 17 µs increments in between the enabling of the heavy load blocks on the device and before the battery measurement is taken If the value is 0 then the battery measurement is taken immediately with the current load of the chip If the value is not 0 the chip is loaded by enabling the PA D...

Page 69: ... will be programmed into the NVM by a special application provided by Silicon Labs See AN511 NVM Programming Utility User s Guide for details The NVM handling is split into several functions Usually the overlay will consist of a single IntelHEX compiled and linked output file which will be converted to a single NVM block In the case of loading an overlay consisting of one NVM block the user needs ...

Page 70: ...leRead Enable analog hardware and NVM for read vNvm_SetAddr wiNvmAddr Set the NVM block first address bStatus bNvm_CopyBlock Copy the NVM block from NVM vNvm_McDisableRead Disable analog hardware and NVM Return bNvm_CopyBlock status return bStatus It is up to the user to include the function above into the application It is not part of API in ROM ...

Page 71: ... function Inputs wiAddr WORD The 16 bit NVM start address of the NVM block to be copied by the next call to the bNvm_CopyBlock Outputs None wNvm_GetAddr Description Returns the NVM address from which the next call to the bNvm_Copy Block is going to start copying the NVM data This address is set either by the vNvm_SetAddr It is also updated by the bNvm_Copy Block call If the user calls this functio...

Page 72: ...aches the last 64 bytes of NVM which are reserved for factory use 3 Special return jump inside the NVM block was used but the next NVM address was outside the valid NVM address space This is an advanced feature supported by special application note and not used by majority of users If no error is encountered and the copy finishes successfully the function returns an NVM block return value byte fou...

Page 73: ...yBlock The hard ware setup can take up to 30 µs Inputs None Outputs None vNvm_McDisableRead Description Disables the NVM related analog and digital hardware This function should be called when the NVM read communication is finished to conserve power If this func tion is called then the user must call the vNvm_McEnableRead again before calling bNvm_CopyBlock Inputs None Outputs None ...

Page 74: ...structure For complete details on implications of structure members see descriptions of corresponding SFR regis ters in the Si4010 data sheet Table notation The LSb means least significant bit s MSb means most significant bit s All the unused bits in the structure fields WORD and BYTEs must be set to 0 The structure values should be calculated by the si4010_calc_regs xls spreadsheet Name Type Bits...

Page 75: ...ATEH ODS_WARM1 and ODS_WARM2 It sets the FSK_MODE field in the ODS_CTRL register as well The input structure items should be set based on the calculation results from si4010_cal c_regs xls spreadsheet Inputs priSetup pointer to tOds_Setup structure instance residing in XDATA For con tents of tOds_Setup structure see table above Outputs None vOds_Enable Description Enables or disables the ODS seria...

Page 76: ...tes data byte to serializer The least significant bit of this byte goes out of the PA first Depending on the set group width not all 8 bits of this byte might be shifted out Inputs biWriteData BYTE This byte is written to the serializer Outputs None ...

Page 77: ...le lists the members belonging to the tPa_Setup structure For complete details on implications of structure members see descriptions of corresponding registers along with the Power Amplifier section in the Si4010 datasheet The structure values should be calculated by the si4010_calc_regs xls spreadsheet See AN547 Si4010 Calculator Spreadsheet Usage for more details Name Type Bits Description fAlph...

Page 78: ...he vPa_Setup function is called prior to calling this function It is also recommended that frequency casting vFCast_Tune and FSK adjustment vFCast_FskAdj functions are called before this function vFCast_Tune sets the DMD TS module for temperature mode This allows the user to simply get the latest temperature reading before calling vPa_Tune Note that the vFCast_Tune leaves the LC oscillator forcibl...

Page 79: ...une the PA with the current temperature vPa_Tune iDmdTs_GetLatestTemp Inputs iiTemp int Current temperature measurement from temperature sensor in inter nal representation 220 bits degC It is the output of the vDmdTs_GetLatestTemp function as shown in the example above Outputs None ...

Page 80: ...ializer and Frequency Casting fine tuning are all used in this Single Transmission Loop module 7 13 1 STL Module Functions vStl_EncodeSetup Description Sets up the byte encoding mechanism to apply for the input frame bytes in the vStl_SingleTxLoop function This function must be called at least once before the first transmission The function sets up the input data encoding for STL module See the En...

Page 81: ...pointer to BYTE in XDATA Pointer to the head of the 8 byte array which will contain the resulting encoded bytes biByteToEncode BYTE Input byte to be encoded Value Header define Description 0 bEnc_NoneNrz_c No encoding raw data byte User can freely choose how many bits from each byte are going to be transmitted by setting tOds_Setup bGroup Width bits 1 1 bEnc_Manchester_c Manchester encoding Input ...

Page 82: ... LC setting 3 Setup and enable the temperature sensor and enable the DMD interrupt and force the global EA flag to be enabled vDmdTs_RunForTemp 3 4 Enable the ODS Note that the ODS interrupt is not enabled and is not used for the STL See vStl_SingleTxLoop for details 5 Wait for the temperature sensor DMD valid sample and then do fine frequency tun ing vFCast_FineTune Since the function calls vDmdT...

Page 83: ...ray index 0 first The ODS will start transmitting bits from the input converted byte bit 0 going to PA first From each converted byte the ODS will transmit only number of bits specified in the tOds_Setup structure item bGroupWidth The ODS function vOds_Setup must be called before any of the STL functions can be used Inputs pbiFrameHead pointer to BYTE in XDATA Points to the first byte in the array...

Page 84: ...the ODS_CTRL ODS_SHIFT_CONTROL field Other API functions do not manipulate that field but if the user changed its value this function will clear it in order to end the transmission After calling this function the user needs to reini tialize the value for the next transmission if a value of other than 0 is desired 3 Disables the ODS 4 Clears the ODS interrupt flag 5 Disables the DMD and TS digital ...

Page 85: ...escription of the vSys_FirstPowerUp function Outputs None vSys_BandGapLdo Description This function controls the bandgap reference and LDO settings All applica tion control of these is to be done through this function This is due to restrictions on when the bandgap can be turned off The bandgap can not be turned off when the vSys_Setup function is called with the biFirstBatteryInsertWaitTime argum...

Page 86: ...s no transmission for a long period of time and only digital is running then it can be beneficial to use setting 0 to turn the BandGap off to save power about 100 uA Note that vStl_PreLoop calls the vSys_BandGapLdo 1 which changes the user set ting After you called the vStl_PreLoop change the bandgap ldo setting back to your lik ing Inputs biBandGapLdoCtrl BYTE Controls the bandgap and LDO states ...

Page 87: ... visible to anybody Inputs None Outputs Production ID LWORD Production ID vSys_SetClkSys Description Sets the system clock division factor field SYSGEN_DIV field of the SYS GEN SFR The setting is guaranteed to be glitch free Only the bottom 3 bits of the biClkSetting are used Upper bits are masked by the function and ignored This simplifies user code when the current clock setting needs to be stor...

Page 88: ... clock oscillator fclk_sys 24MHz 2biClkSetting Only the bottom 3 bits of the biClkSetting are used the rest is ignored Outputs None lSys_GetMasterTime Description Returns the current master time Master time is recommended to be stored in units of ms User application is fully responsible to update the time by calling vSys_Inc MasterTime in regular fashion to update the master time appropriately Thi...

Page 89: ...tion appropriately Inputs biIncAmount BYTE Value to add to the master time counter Outputs None vSys_SetMasterTime Description Sets the master time variable to a specific value Inputs liSetAmount LWORD Value to set master time to Outputs None vSys_LedIntensity Description Sets the intensity of the LED on GPIO5 The user then can control the LED on and off at the preset intensity level by controllin...

Page 90: ...mperature measurement from scratch Since the function calls vDmdTs_RunForTemp it forces the DMD interrupt enable flag EDMD and the global interrupt enable flag EA to be enabled EDMD 1 EA 1 If the user does not desire the temperature demodulator or temperature sensor running after the return from the function then the user is required to disable those manually after the return from this function Di...

Page 91: ...n t shut down correctly 2 Sets the PORT_HOLD bit of SYSGEN SFR This blinds the chip to new button pushes 3 Sets the SYSGEN_SHUTDOWN bit of the SYSGEN SFR This shuts the chip down Only HVRAM sleep timer and Matrix and Roff mode latches are powered when the chip is in the shutdown mode 4 Stop the CPU by setting the STOP bit in the PCON register Inputs None Outputs None bSys_GetBootStatus Description...

Page 92: ...does the following 1 Initialize the Sleep Timer 2 Clear the HVRAM 3 Initialize the HVRAM battery voltage byte to 0xFF 4 Waits for the time specified by the argument biFirstBatteryInsertWaitTime of vSys_Setup 5 Calls vSys_Shutdown For example Call the system setup vSys_Setup 20 Wait 800ms Check the first power on bit if 0 SYSGEN M_POWER_1ST_TIME vSys_FirstPowerUp Function will shutdown Inputs None ...

Page 93: ... µs The function does not disable any interrupts It is fully interruptible If the user does not desire this function to be interrupted he has to disable the interrupts prior to calling this function Inputs wiIntervalCount WORD Determines the number of system clock cycles spent inside of the function as shown in the expression above Outputs None vSys_8BitDecLoop Description Implements software dela...

Page 94: ...n produce is 35 255 x 10 2585 cycles resulting in 107 µs delay The delay resolution is 10 cycles corresponding to 0 417 µs The function does not disable any interrupts It is fully interruptible If the user does not desire this function to be interrupted he has to disable the interrupts prior to calling this function Inputs biIntervalCount BYTE Determines the number of system clock cycles spent ins...

Page 95: ... functions bSleepTim_CheckDutyCycle and vSleepTim_AddTxTimeToCounter Note that there is no automatic duty cycle enforcement implemented It is up to the user application to use the Sleep Timer functions to decide whether to transmit or not 7 15 1 Sleep Timer Module Functions lSleepTim_GetCount Description Reads the sleep timer and stores the counter value in the LWORD global variable and also retur...

Page 96: ...e enforcement or 1 if the next transmission will not violate duty cycle enforcement vSleepTim_AddTxTimeToCounter Description Adds the appropriate value to the sleep timer based on the transmission time of the next packet Some preprocessing of the transmission time is required before passing it to this function Callers must run the transmit time through the following equation before passing it in a...

Page 97: ...RD Result of the equation listed above Outputs None lSleepTim_GetOneHourValue Description Returns the value which represents one hour count of the sleep timer When this value is set into the counter it will time out in 1 hour The user has to linearly scale this value to get the desired time to be set into the counter for chip wake up For example if the user wants to use sleep timer to wake the chi...

Page 98: ..._Setup xdata rOds_Setup Structure for setting up the PA must be in XDATA tPa_Setup xdata rPa_Setup Data byte frame the pointer must point to XDATA BYTE xdata pbFrameHead Disable the Matrix and Roff modes on GPIO 3 1 PORT_CTRL M_PORT_MATRIX M_PORT_ROFF M_PORT_STROBE PORT_CTRL M_PORT_STROBE PORT_CTRL M_PORT_STROBE Turn the LED off GPIO_LED 0 SETUP PHASE Call the system setup This just for initializa...

Page 99: ... wNominalCap 256 rPa_Setup bMaxDrv 0 Setup the PA vPa_Setup rPa_Setup Setup the ODS rOds_Setup bModulationType 1 Use FSK rOds_Setup bClkDiv 5 rOds_Setup bEdgeRate 0 Set group width to 7 which means 8 bits encoded byte to be transmitted The value must match the output width of the data encoding function set by the vStl_EncodeSetup below rOds_Setup bGroupWidth 7 rOds_Setup wBitRate 417 Configure the...

Page 100: ...desired per button push this while loop could be eliminated and the vStl_PostLoop could be followed by a call to vSys_Shutdown while 1 Wait for a button press wait here in infinite loop for a button to be pushed or held If not buttons are pushed then wait for button push See the comment about vSys_Shutdown above while 0xdf P0 0xdf 0x03 P1 0x03 Run at 433 46 MHz Continue to tune frequency between f...

Page 101: ...temperature sample while 0 bDmdTs_GetSamplesTaken Tune the PA with the current temperature as an argument vPa_Tune iDmdTs_GetLatestTemp Run the Single Tx Loop vStl_PreLoop vStl_SingleTxLoop pbFrameHead bFCastDemo_MaxFrameSize_c Post processing transmission end vStl_PostLoop 1 ...

Page 102: ...uilding an Application on page 16 Updated Step 4 in 4 9 Compiling an Application on page 18 Revision 0 4 to Revision 0 5 Descriptions of functions used only by the API internally were removed Numerous clarifications and corrections added Revision 0 5 to Revision 1 0 Updated lSys_GetProdId section on page 87 ...

Page 103: ...AN370 Rev 1 0 103 NOTES ...

Page 104: ...lth which if it fails can be reasonably expected to result in significant personal injury or death Silicon Laboratories products are generally not intended for military applications Silicon Laboratories products shall under no circumstances be used in weapons of mass destruction including but not limited to nuclear biological or chemical weapons or missiles capable of delivering such weapons Trade...

Reviews: