PA, and the data is modulated by OOK and transmitted out. The MCU of the chip controls the RF part by the 3-wire SPI interface, and achieves various status switching, mode selection and low power control. www.cmostek.com V1.2 | Page 6/92...
General IO, support IOC, can be configured as pull-up PA0/C1IN+/ICSPCLK Digital C1IN+ Comparator1 input+ Debug/ burning mode serial port Clock ICSPCLK signal General IO, support IOC, can be PA1/C1IN-/ICSPDAT Digital configured as pull-up C1IN- Comparator1 input - www.cmostek.com V1.2 | Page 7/92...
Page 8
3. PC<3:0> is the internal control pin of the chip and not the package terminal, but it is used as a bus to control the RF. www.cmostek.com V1.2 | Page 8/92...
(except PC1). 4. The RFCTRL pin can be suspended in this mode. 5. In this mode, the transmitted data pin is PC1(SDIO), which is set to 0 in the low power consumption www.cmostek.com V1.2 | Page 9/92...
3. The Direct mode which is supported by the advanced configuration mode is similar to the Direct mode of the simple work mode, by which is controlled by one data pin, but the data input source is different. In the www.cmostek.com V1.2 | Page 10/92...
SDIO needs to switch from the output state to input state before the eighth clock falling edge. > 0. 5 SCLK cycle > 0. 5 SCLK cycle RFCTRL PC3/CSB PC2/SCLK PC /SDIO r/ w = 1 register address register read data Figure 2-2. SPI Read Register Timing www.cmostek.com V1.2 | Page 11/92...
RFPDK software. The specific approach is to open the RFPDK software and select the CMT2157B model (the same specifications and performance as the CMT2189B built-in RF), as shown in the following figure. Figure 2-4. RFPDK CMT2157B Interface www.cmostek.com V1.2 | Page 12/92...
Page 13
Users configuration are based on the requirements according to the relevant registers below, and then click Export to generate an exp file, which is as follows: ;--------------------------------------- ; CMT2157B Configuration File ; Generated by CMOSTEK RFPDK 1.46 ; 2017.11.14 13:47 ;--------------------------------------- ; (The annotation with ";" in the middle is omitted.) ;---------------------------------------...
Page 14
AN201 ; The following are for CMOSTEK ; use, customers can ignore them ;--------------------------------------- 0x0000 0x0018 Among them, the red font part is the specific configuration content, they are all 16-bit word, a total of 24 words, so users need to convert the 16-bit word to the 8-bit register content. The method of conversion is that the higher 8-bit of each 16-bit word is an odd number address, and the lower 8-bit is an even address.
Bank Address Involved Content 0x00 – 0x03 Tx Bank Tx frequency,Tx power Tx rate, packet format (only for hardware packet Tx 0x04 – 0x27 Packet Bank mode) 0x28 – 0x2E System Bank System working parameters www.cmostek.com V1.2 | Page 15/92...
2.7.2 Hardware Packet Format The interior of the CMT2189B supports the hardware packet structure, and its data frame structure is as follows: Head/ Stop Preamble ID/ADDR Key Value Pause/Interval Sync Status Figure 2-5. Packet Structure www.cmostek.com V1.2 | Page 17/92...
2.7.3 Preamble Table 2-5. Preamble Configuration Register Register Bits Bit Name Function Description Name When enabling Tcycle, it represents the CUS_PKT1 PREAMBLE_LOCATION Preamble location in the packet structure: (0x08) 0:In one cycle, each packet contains 1 www.cmostek.com V1.2 | Page 18/92...
Sync, and the Symbol is random in length. CUS_PKT5 SYNC_HEADER<7:0]> (0x0C) CUS_PKT6 The value of the Sync can be filled in different SYNC_HEADER<15:8> (0x0D) registersaccording to the different CUS_PKT7 SYNC_LENGTH settings, please look at the next SYNC_HEADER<23:16> table. (0x0E) CUS_PKT8 SYNC_HEADER<31:24> (0x0F) www.cmostek.com V1.2 | Page 19/92...
Symbol, and so on, and 7 represents 8 Symbols. CUS_PKT15 BIT_LOGIC_L<7:0> Logic 0 definition (0x16) CUS_PKT16 BIT_LOGIC_H<7:0> Logic 1definition (0x17) CUS_PKT9 ADDR_ID<7:0> (0x10) CUS_PKT10 ADDR_ID<15:8> (0x11) Addr ID value CUS_PKT11 ADDR_ID<23:16> (0x12) CUS_PKT12 ADDR_ID<31:24> (0x13) www.cmostek.com V1.2 | Page 20/92...
Page 21
15, the length is 16 Logic bits, the value is 0x5678, then the user will fill the value into ADDR_ID<31:24> and ADDR_ID<23:16> registers, MSB is corresponding to the thirty-first bit, LSB is corresponding to the sixteenth bit, that is , 0x56 is filled into ADDR_ID<31:24>, 0x78 is filled into ADDR_ID<23:16>. www.cmostek.com V1.2 | Page 21/92...
The Key Value length can be configured to 0~7, CUS_PKT4 and 0 represents sending the Key of 1 Logic bit, KEY_LENGTH<2:0> (0x0B) and so on, 7represents sending the Key of 8 Logic bits, and the Logic bit length is random. www.cmostek.com V1.2 | Page 22/92...
The voltage comparison threshold of the LBD, if the actual voltage is greater than the LBD_TH<3:0> threshold, the LBD result is 1 (logic 1), and conversely, it is 0 (logic 0). CUS_LBD_RESULT LBD_RESULT<3:0> Voltage measurement value (0x4B) www.cmostek.com V1.2 | Page 23/92...
Page 24
Section 2.7.1” Packet Structure” in details. In the chip, the voltage value is converted by 4bits's ADC. The LBD_RESULT is obtained by each step of 0.2V, and the relationship between the voltage value and LBD_RESULT is as follows: www.cmostek.com V1.2 | Page 24/92...
0 represents sending the Stop of 1 Symbol, STOP_LENGTH<3:0> (0x15) and so on, 15 represents sending the Stop of16 Symbols, and the Symbol length is random. CUS_PKT27 STOP_BIT<7:0> (0x22) STOP_BIT Value CUS_PKT28 STOP_BIT<15:8> (0x23) www.cmostek.com V1.2 | Page 25/92...
N data packets are transmitted repeatedly and there are Pause/Interval between the packets,or N data packets compose one group and one transmission cycle contains M groups. These ways are shown in the following figure. www.cmostek.com V1.2 | Page 26/92...
Page 27
Preamble in the packet structure. CUS_PKT1 PREAMBLE_LOCATION 0: In one cycle, each Packet contains 1 Preamble, (0x08) i.e. in one cycle, N Packets contain N Preambles. 1: In one cycle, only 1 Preamble is included, www.cmostek.com V1.2 | Page 27/92...
1. After executing the soft_rst, the chip is reset again, and the user needs to update the configuration register according to the requirement. 2. After power-up, the configuration register is based on the internal default value (that is, the EERPOM value burned by the factory) before the configuration register (CFG) is configured. www.cmostek.com V1.2 | Page 28/92...
Return SLEEP status CUS_MODE Status-jump go_tx 0x02 Enter TX status (0x33) go_stby 0x08 Enter STBY status 2.8.3 Work Status Query The user needs to query the current work status by reading the CUS_STATUS (0x4D) status register, of www.cmostek.com V1.2 | Page 29/92...
Note: 1. When the transmission is started up again, the transmission process will be re executed. 2. In the fourth step, users need to use "read-modify-write" to avoidmodifying thevalue of other bits by www.cmostek.com V1.2 | Page 30/92...
1. In the fifth step, the configuration register only needs to be configured as 0x00~0x03, which can adjust the Tx frequency and Tx power, and the others can be ignored. 2. When the transmission is started up again, execute the Tx process once again. www.cmostek.com V1.2 | Page 31/92...
PC0 next time. So users need to think according to the encoding format. TX_OVERTIMES is 20ms by default, and can be added to 90ms that the stepping is 10ms. www.cmostek.com V1.2 | Page 32/92...
- - - - 1 1 1 1 - - - - - - - - - - - - - - - - Bank0’s SRAM, which is the general RAM of 96Bytes. 20-7F x x x x x x x x www.cmostek.com V1.2 | Page 34/92...
- - - - F0-FF Access Bank0’s 0x70~0x7F. x x x x x x x x SRAM, Note: 1. INDF is not a physical register. 2. The gray part is unimplemented, please do not access. www.cmostek.com V1.2 | Page 35/92...
Carry/ bit(ADDWF、ADDLW、SUBLW、SUBWF instructions) 1 = A carry/ from the Most Significant bit of the result occurred 0 = No carry/ from the Most Significant bit of the result occurred www.cmostek.com V1.2 | Page 36/92...
Type Table 4-8. PORTA Bit Function Description Name Function PORTA7 data PORTA6 data PORTA5 has only the input function.There is no corresponding output data register. PORTA4 data PORTA3 data PORTA2 data PORTA1 data PORTA0 data www.cmostek.com V1.2 | Page 37/92...
Comparator2 Interrupt Flag bit C2IF 1 = Comparator2 output has changed 0 = Comparator2 output has not changed Comparator1 Interrupt Flag bit C1IF 1 = Comparator1 output has changed 0 = Comparator1 output has not changed www.cmostek.com V1.2 | Page 39/92...
When CM[2:0]=010, 1 = C1IN+ connects to C1VIN+, C2IN+ connects to C2VIN+ 0 = C1IN- connects to C1VIN-,C2IN- connects to C2VIN- When CM[2:0]=001, 1 = C1IN+ connects to C1VIN+ 0 = C1IN- connects to C1VIN- www.cmostek.com V1.2 | Page 42/92...
SLVREN = 1 means LVR is enabled in operating mode and automatically disabled in SLVREN sleep mode. SLVREN = 0 means LVR is always enabled. 2. When LVREN is disabled in compiling option LVR is disabled regardless of SLVREN value. www.cmostek.com V1.2 | Page 43/92...
Bit3 Bit2 Bit1 Bit0 TRISA TRISA7 TRISA6 TRISA5 TRISA4 TRISA3 TRISA2 TRISA1 TRISA0 Reset Type Table 4-32. TRISA Bit Function Description Name Function PORTA<7:6> port direction Control bits TRISA<7:6> 1 = Input 0 = Output www.cmostek.com V1.2 | Page 45/92...
Table 4-41. PR2 Register Name Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 PR2<7:0> Reset 0xFF Type Table 4-42. PR2 Bit Function Description Name Function Timer2 period (comparison) register (See the Timer2 description chapter in PR2<7:0> details.) www.cmostek.com V1.2 | Page 48/92...
Write operation, 1= Initiates a data EEPROM programming cycle 0= No function 4.1.30 Configuration Register UCFGx The software does not access UCFG0, UCFG1 and UCFG2.They are only written by the hardware (burning) in the power-up process. www.cmostek.com V1.2 | Page 51/92...
Page 52
1xx = INTOSCIO mode, both PA6 and PA7 are the IO pins UCFG1address is 0x2001 in PROM Table 4-57. UCFG1 Configuration Register Name Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 UCFG1 TSEL FCMEN IESO RD_CTRL LVDEN<1:0> www.cmostek.com V1.2 | Page 52/92...
PC will be cleared.The following figure shows the two situations for the loading of PC.Notice the LCALL and LJUMP instructions on the right side of the figure. Because the operating code in the instruction www.cmostek.com V1.2 | Page 53/92...
0~255.Any instruction that uses the INDF register is actually access to the unit that the file selection register FSR points to.Reading the INDF indirectly will return 0. Writing the INDF indirectly will cause the control operation. (It may affect the status flag bit.) www.cmostek.com V1.2 | Page 54/92...
EC mode, the crystal resonator XT and LP mode. The internal clock mode is built in the oscillator module. The oscillator module has a 16MHz high frequency oscillator and a 32KHz low frequency oscillator. www.cmostek.com V1.2 | Page 55/92...
Internal Oscillator Frequency Select bitI RCF<2:0> can be operated to select the system clock speed via software. The system clock can be selected between the external or internal clock source via System Clock Select bit (SCS) of the OSCCON register. www.cmostek.com V1.2 | Page 56/92...
4. Hold CLKOUT to low, the clock switch circuit waits for the arrival of the falling edge oftwo new clocks. 5. CLKOUT is now connected with the new clock, and the HTS and LTS bits of the OSCCON register are updated as required. 6. Clock switch is completed. www.cmostek.com V1.2 | Page 57/92...
Any clock switching caused by the hardware (possibly from Two-Speed Start-up or Fail-Safe Clock Monitor) will not update the SCS bit of the OSCCON register.The user should monitor the OSTS bit of the OSCCON register to determine the current system clock source. www.cmostek.com V1.2 | Page 58/92...
If the external clock oscillator is configured as any mode except the LP or XT mode, the Two-Speed Start-up will be disabled.This is because the external clock oscillation does not require any stablilization time after POR or an exit from Sleep. www.cmostek.com V1.2 | Page 59/92...
When the external clock fault occurs, the FSCM switches the device clock to the internal clock source, and the OSFIF flag bit of the PIR1 register is set to 1.If setting the OSFIF flag bit to 1while setting the OSFIE bit of the www.cmostek.com V1.2 | Page 60/92...
(i.e., after exiting Reset or Sleep). After an appropriate amount of time, the user should check the OSTS bit of the OSCCON register to verify whether the oscillator has successfully started and whether the system clock has been switched successfully. www.cmostek.com V1.2 | Page 61/92...
6-1 and Table 6-2 in details. The /MCLRB pin corresponding circuit has the anti shake function. It can filter the sharp pulse signal caused by the interference. The following figure is the overall block diagram of the reset circuit: www.cmostek.com V1.2 | Page 62/92...
(such as ESD event) can result in both /MCLRB Reset and excessive current beyond the device specification. Therefore, we recommend that users no longer connect /MCLRB to VDD directly with one resistor but use the following circuit. 100R /MCLRB 0.1uF Figure 6-2. External Reset Reference Circuit Diagram www.cmostek.com V1.2 | Page 63/92...
/MCLR holds long enough in the low level status, the timeout event will take place. If the /MCLR is pulled up, the CPU will start immediately. This will be useful when testing or requiring multiple MCU synchronization. www.cmostek.com V1.2 | Page 64/92...
Page 65
/POR bit, which is 0 on Power-on Reset, and the software must set it to 1. POR_RSTN 4ms delay BOOT_EN PWRTE BOOT_END PWRT,64ms PWRT_OV MCLRB SYS_RSTN Figure 6-3. Power-on Reset with MCLRB POR_RSTN 4ms delay BOOT_EN PWRTE BOOT_END PWRT,64ms PWRT_OV MCLRB SYS_RSTN Figure 6-4. Power-on Reset without MCLRB www.cmostek.com V1.2 | Page 65/92...
Page 66
Brown-out Reset Oscillator Sleep Wake-up configuration /PWRTEB=0 /PWRTEB=1 /PWRTEB=0 /PWRTEB=1 INTOSC TPWRT TPWRT Table 6-2. STATUS/PCON Bit and Significance(U-No change,X-Unknown) /POR /BOR Condition WDT Reset WDT Wake-up /MCLR Reset during normal operation /MCLR Reset during Sleep www.cmostek.com V1.2 | Page 66/92...
After POR or BOR, inserting a status, the unit of EEPROM is mapped into a configuration register.The address of EEPROM starts from 2000H. The system reset is released until the end of the BOOT, as shown in Figure 6-3 and Figure 6-4.The process needs about 14us. www.cmostek.com V1.2 | Page 67/92...
If the internal slow clock switches from 32K to 256K mode (or vice versa from 256K to 32K mode), it doesn't affect the watchdog timing, because WDT is fixed to use the 32K clock source. www.cmostek.com V1.2 | Page 68/92...
In this mode, the timer0 adds 1 when it is triggered by the rising or falling edge of each T0CKI pin (without prescaler). The T0SE bit of the OPTION register determines which edge to be triggered. The software can set the T0CS bit of OPTION register to 1 to enter the counter mode. www.cmostek.com V1.2 | Page 69/92...
TMR0 select and prescaler bits ANDWR OPTION_REG, W IORWI b’00000011’;Set prescaler to 1:16 OPTION_REG 9.3.2 Timer0 Interrupt An interrupt is generated (if enabling the interrupt) and the T0IF bit is set when the TMR0 timer overflows from www.cmostek.com V1.2 | Page 70/92...
Q1 and Q2 cycles of the internal clock phase, so the high level time and low level time of the external clock source cycle must meet the relevant timing requirement. www.cmostek.com V1.2 | Page 71/92...
1:1 to 1:16. The output of the Timer2 postscaler is used to set the interrupt flag bit TMR2IF of the PIR1 register to 1. Note: Both TMR2 and PR2 are read-write registers. Their values are initialized to 0 and 0xFF respectively upon www.cmostek.com V1.2 | Page 72/92...
Page 73
The Timer2 postscaler is controlled by the TOUTPS bit of the T2CON register. The prescalercounter and postscaler counter will be cleared when the following register is written: Write TMR2 Write T2CON Any Reset action Writing T2CON does not clear the TMR2 register. www.cmostek.com V1.2 | Page 73/92...
When the word "D" is marked on the port, the user should set the corresponding TRIS bit to 0 to open the digital output driver circuit. In addition, the comparator configuration switching should mask the comparator interrupt to avoid unnecessary mistrigger events. www.cmostek.com V1.2 | Page 74/92...
EEDAT register.This data can therefore be read by the next instruction. EEDAT will keep this value until the user reads or writes data to the unit next time (during the write operation). BANKSEL EEADR LDWI dest_addr EEADR EECON1, RD EEDAT, W www.cmostek.com V1.2 | Page 75/92...
When the interrupt flag is checked to be 1, the read SOSCPR is the final result. CKMAVG BUS<1> CKCNTI MSCKCON WR CKMEAS EN T2 SYSCLK MEAS DONE SYSCLK TMR2 16-bit SOSCPR<11:0> To INT Figure 13-1. Slow Clock Measurement Mode Block Diagram www.cmostek.com V1.2 | Page 76/92...
1 before entering the sleep status, the INT interrupt can wake up the MCU from the sleep status. Note: When INT interrupt is used, the ANSEL and CM2CON0 registers must be initialized so that the analog www.cmostek.com V1.2 | Page 77/92...
The external interrupt includes the interrupt from the INT pin or the PORTA change interrupt, and the interrupt delay is usually 1 to 2 instruction cycles. It depends on the actual situation of the interrupt. INT(PA2) INTF 中断矢量 PC-1 PC+1 PC+2 0x004 0x005 Figure 14-1. Interrupt Response Timing Diagram www.cmostek.com V1.2 | Page 78/92...
The temporary registers W_TEMP and STATUS_TEMP should be placed in the last 16 Bytes of the GPR.The 16 Bytes of GPR cross two pages, so users can save a little bit of code space. www.cmostek.com V1.2 | Page 80/92...
Clearing watchdog (CLRWDT) and SLEEP instruction will clear the watchdog counter. When enabling the watchdog, the watchdog overflowing event can be used as a wake-up source when MCU is in Sleep, while it can be used as a reset source when MCU works normally. www.cmostek.com V1.2 | Page 81/92...
Each port of the PORTA can be separately set as an interrupt source (interrupt-on-change). Controlling the bitof the IOCAx register can enable or turn off the interrupts of these ports. The interrupt-on-change is invalid on Power-on Reset. www.cmostek.com V1.2 | Page 82/92...
The following figure describes the internal circuit architecture of the port, and PA<2:0> can be configured as the following functional port: GPIO Debug serial clock (PA0) Debug serial data (PA1) External interrupt input (PA2) Timer0 external clock source (PA2) www.cmostek.com V1.2 | Page 83/92...
On Change T0CKI (PA2 Only) Figure 16-1. PA<2:0> Architecture Block Diagram 16.3.2 PORTA3/PA3 The following figure describes the internal circuit architecture of the port, and PA3 can be configured as the following functional port: GPIO www.cmostek.com V1.2 | Page 84/92...
Page 85
PORTA ATEST1 EN TRISA TRISA PORTA IOCA PORTA IOCA Interrupt On Change Figure 16-2. PA3 Architecture Block Diagram Note: ATEST1 is used for the internal test, not open to users, and users can ignore it. www.cmostek.com V1.2 | Page 85/92...
ATEST0 EN TRISA TRISA PORTA IOCA PORTA IOCA Interrupt On Change Figure 16-3. PA4 Architecture Block Diagram Note: ATEST0 and IR are used for the internal test, not open to users, and users can ignore them. www.cmostek.com V1.2 | Page 86/92...
Comparator output (only PC4, but not available, because it is used to control the RF part) (Only PC4) C2OUT Enable C2OUT Data PORTC Analog Input mode TRISC TRISC To Comparator PORTC (Only PC0 & PC1) Figure 16-5. PC7~PC0 Architecture Block Diagram www.cmostek.com V1.2 | Page 88/92...
Load immediate to W I-> W NONE A N DW I AND W and imm W& I-> W IORW I Inclu.OR W and imm W| I-> W X O RW I Exclu.OR W and imm W^ I-> W www.cmostek.com V1.2 | Page 89/92...
Page 90
Subtract W from imm I-W-> W C, HC, Z Note: The TMODE register of the chip refers to the OPTION, that is, the operation of the STTMD instruction is to save the W to OPTION. www.cmostek.com V1.2 | Page 90/92...
The material contained herein is the exclusive property of CMOSTEK and shall not be distributed, reproduced, or disclosed in whole or in part without prior written permission of CMOSTEK. CMOSTEK products are not authorized for use as critical components in life support devices or systems without express written approval of CMOSTEK.
Need help?
Do you have a question about the NextGenRF CMT2189B and is the answer not in the manual?
Questions and answers