CYRF69303 Programmable Radio-on-Chip LPstar Programmable Radio-on-Chip LPstar Features Operating temperature from 0 C to 70 C Closed-loop frequency synthesis for minimal frequency drift Radio System-on-Chip with built-in 8-bit MCU in a single device. Operates in the unlicensed worldwide Industrial, Scientific, and Medical (ISM) band (2.400 GHz to 2.483 GHz). Auto transaction sequencer (ATS): MCU can remain in sleep state longer to save power On Air compatible with second WirelessUSBTM LP and PRoC LP. Framing, length, CRC16, and Auto ACK Pin-to-pin compatible with PRoC LP except the pin 31 and pin 37. Separate 16 byte transmit and receive FIFOs Receive signal strength indication (RSSI) Built-in serial peripheral interface (SPI) control while in Sleep Mode generation radio Intelligent Simple Development M8C based 8-bit CPU, optimized for human interface devices (HID) applications Advanced development tools based on Cypress's PSoC(R) tools 256 bytes of SRAM Flexible I/O 8 Kbytes of flash memory with EEPROM emulation 2 mA source current on all GPIO pins. Configurable 8 mA or 50 mA/pin current sink on designated pins In-system reprogrammable through D+/D- pins CPU speed up to 12 MHz 16-bit free running timer Each GPIO pin supports high impedance inputs, configurable pull up, open drain output, CMOS/TTL inputs, and CMOS output Low power wakeup timer Maskable interrupts on all I/O pins 12-bit programmable interval timer with interrupts BOM Savings Watchdog timer Low external component count Small footprint 40-pin QFN (6 mm x 6 mm) GPIOs that require no external components Operates off a single crystal Low Power 21 mA operating current (Transmit at -5 dBm) Sleep current less than 1 A Operating voltage from 2.7 V to 3.6 V DC Applications Fast startup and fast channel changes Wireless keyboards and mice Supports coin cell operated applications Presentation tools Wireless gamepads Remote controls Toys Fitness Reliable & Robust Receive sensitivity typical -90 dBm AutoRateTM - Dynamic Data Rate Reception Enables data reception for any of the supported bit rates automatically. DSSS (250 Kbps), GFSK (1 Mbps) Cypress Semiconductor Corporation Document Number: 001-66502 Rev. *C * 198 Champion Court * San Jose, CA 95134-1709 * 408-943-2600 Revised September 6, 2012 CYRF69303 nSS VIO VCC1 VCC2 VCC3 VCC4 VBat0 VBat1 VBat2 VCC RST VDD_MICRO VCC SCK MOSI Logic Block Diagram RFbias RFp RFn Microcontroller Function P0_1,3,4,7 4 Radio Function IRQ/GPIO P1.5/MOSI MISO/GPIO P1.4/SCK P1_0:2,6:7 5 XOUT/GPIO P1.3/nSS 12 MHz Document Number: 001-66502 Rev. *C Vdd ..... GND GND RESV Xtal GND P2_0:1 2 ....... Page 2 of 69 CYRF69303 Contents Functional Description ..................................................... 4 Functional Overview ........................................................ 4 2.4 GHz Radio Function .............................................. 4 Data Transmission Modes ........................................... 4 Microcontroller Function .............................................. 4 Backward Compatibility ............................................... 4 Pinouts .............................................................................. 5 Pin Definitions .................................................................. 5 Functional Block Overview .............................................. 6 2.4 GHz Radio ............................................................. 6 Frequency Synthesizer ................................................ 6 Baseband and Framer ................................................. 6 Packet Buffers and Radio Configuration Registers ..... 7 Auto Transaction Sequencer (ATS) ............................ 7 Interrupts ..................................................................... 7 Clocks .......................................................................... 8 GPIO Interface ............................................................ 8 Power-on Reset ........................................................... 8 Timers ......................................................................... 8 Power Management .................................................... 8 Low Noise Amplifier (LNA) and Received Signal Strength Indication (RSSI) ................................................................ 9 SPI Interface ...................................................................... 9 Three-Wire SPI Interface ............................................. 9 Four-Wire SPI Interface ............................................... 9 SPI Communication and Transactions ...................... 10 SPI I/O Voltage References ...................................... 10 SPI Connects to External Devices ............................ 10 CPU Architecture ............................................................ 11 CPU Registers ................................................................. 11 Flags Register ........................................................... 11 Accumulator Register ................................................ 12 Index Register ........................................................... 12 Stack Pointer Register ............................................... 12 CPU Program Counter High Register ....................... 12 CPU Program Counter Low Register ........................ 12 Addressing Modes ......................................................... 13 Source Immediate ..................................................... 13 Source Direct ............................................................. 13 Source Indexed ......................................................... 13 Destination Direct ...................................................... 13 Destination Indexed ................................................... 14 Destination Direct Source Immediate ........................ 14 Destination Indexed Source Immediate .................... 14 Destination Direct Source Direct ............................... 14 Source Indirect Post Increment ................................. 15 Destination Indirect Post Increment .......................... 15 Instruction Set Summary ............................................... 16 Memory Organization ..................................................... 17 Flash Program Memory Organization ....................... 17 Data Memory Organization ....................................... 18 Document Number: 001-66502 Rev. *C Flash .......................................................................... 18 SROM ........................................................................ 18 SROM Function Descriptions .................................... 19 Clocking .......................................................................... 22 SROM Table Read Description ................................. 23 Clock Architecture Description .................................. 24 CPU Clock During Sleep Mode ................................. 28 Reset ................................................................................ 29 Power-on Reset ......................................................... 30 Watchdog Timer Reset .............................................. 30 Sleep Mode ...................................................................... 30 Sleep Sequence ........................................................ 30 Low Power in Sleep Mode ......................................... 31 Wakeup Sequence .................................................... 31 Power-on Reset Control ................................................. 32 POR Compare State ................................................. 33 ECO Trim Register .................................................... 33 General-Purpose I/O Ports ............................................. 33 Port Data Registers ................................................... 33 GPIO Port Configuration ........................................... 34 GPIO Configurations for Low Power Mode ............... 40 Serial Peripheral Interface (SPI) ................................ 41 SPI Data Register ...................................................... 42 SPI Configure Register .............................................. 42 SPI Interface Pins ...................................................... 44 Timer Registers .............................................................. 44 Registers ................................................................... 44 Interrupt Controller ......................................................... 47 Architectural Description ........................................... 47 Interrupt Processing .................................................. 48 Interrupt Latency ....................................................... 48 Interrupt Registers ..................................................... 48 Microcontroller Function Register Summary ............. 53 Radio Function Register Summary ............................... 55 Absolute Maximum Ratings .......................................... 56 DC Characteristics ......................................................... 56 AC Characteristics ......................................................... 58 Switching Waveforms .................................................... 59 RF Characteristics .......................................................... 62 Ordering Information ...................................................... 64 Ordering Code Definitions ......................................... 64 Package Handling ........................................................... 65 Package Diagrams .......................................................... 65 Acronyms ........................................................................ 67 Document Conventions ................................................. 67 Units of Measure ....................................................... 67 Document History Page ................................................. 68 Sales, Solutions, and Legal Information ...................... 69 Worldwide Sales and Design Support ....................... 69 Products .................................................................... 69 PSoC Solutions ......................................................... 69 Page 3 of 69 CYRF69303 Functional Description PRoC LPstar devices are integrated radio and microcontroller functions in the same package to provide a dual-role single-chip solution. Communication between the microcontroller and the radio is through the radio's SPI interface. Functional Overview The CYRF69303 is a complete Radio System-on-Chip device, providing a complete RF system solution with a single device and a few discrete components. The CYRF69303 is designed to implement low-cost wireless systems operating in the worldwide 2.4 GHz Industrial, Scientific, and Medical (ISM) frequency band (2.400 GHz to 2.4835 GHz). 2.4 GHz Radio Function The SoC contains a 2.4 GHz, 1 Mbps GFSK radio transceiver, packet data buffering, packet framer, DSSS baseband controller, received signal strength indication (RSSI), and SPI interface for data transfer and device configuration. The radio supports 98 discrete 1 MHz channels (regulations may limit the use of some of these channels in certain jurisdictions). The baseband performs DSSS spreading/despreading, Start of Packet (SOP), End of Packet (EOP) detection, and CRC16 generation and checking. The baseband may also be configured to automatically transmit Acknowledge (ACK) handshake packets whenever a valid packet is received. When in receive mode, with packet framing enabled, the device is always ready to receive data transmitted at any of the supported bit rates. This enables the implementation of mixed-rate systems in which different devices use different data rates. This also enables the implementation of dynamic data rate systems that use high data rates at shorter distances or in a low-moderate interference environment or both. It changes to lower data rates at longer distances or in high interference environments or both. Data Transmission Modes The radio supports two different data transmission modes: In GFSK mode, data is transmitted at 1 Mbps, without any DSSS In DSSS mode eight bits (8DR, 32 chip) are encoded in each derived code symbol transmitted, resulting in effective 250 kbps data rate. 32 chip Pseudo Noise (PN) codes are supported. The two data transmission modes apply to the data after the SOP. In particular the length, data, and CRC16 are all sent in the same mode. In general, DSSS reduce packet error rate in any environment. Microcontroller Function The MCU function is an 8-bit Flash-programmable microcontroller. The instruction set is optimized specifically for HID and a variety of other embedded applications. The MCU function has up to 8 Kbytes of Flash for user's code and up to 256 bytes of RAM for stack space and user variables. In addition, the MCU function includes a Watchdog timer, a vectored interrupt controller, a 16-bit Free Running Timer, and 12-bit Programmable Interrupt Timer. The microcontroller has 15 GPIO pins grouped into multiple ports. With the exception of the four radio function GPIOs, each GPIO port supports high impedance inputs, configurable pull-up, open drain output, CMOS/TTL inputs and CMOS output. Up to two pins support programmable drive strength of up to 50 mA. Additionally, each I/O pin can be used to generate a GPIO interrupt to the microcontroller. Each GPIO port has its own GPIO interrupt vector with the exception of GPIO Port 0. GPIO Port 0 has two dedicated pins that have independent interrupt vectors (P0.3 - P0.4). The microcontroller features an internal oscillator. Backward Compatibility The CYRF69303 IC is fully interoperable with the main modes of the second generation Cypress radio SoC namely the CYRF6936, CYRF69103 and CYRF69213. CYRF69303 IC device may transmit data to or receive data from a second generation device, or both. Document Number: 001-66502 Rev. *C Page 4 of 69 CYRF69303 Pinouts Figure 1. 40-pin QFN pinout NC 31 P1.6 32 VIO 33 RST 34 P1.7 35 VDD_1.8 36 GND 37 P0.7 38 Vcc 40 VBAT0 39 Corner tabs P0.4 1 30 XOUT / GPIO XTAL 2 29 MISO / GPIO VCC 3 28 P1.5 / MOSI P0.3 4 P0.1 5 VBAT1 6 VCC 7 P2.1 8 VBAT2 9 27 IRQ / GPIO CYRF69303 PRoC LPstar 26 P1.4 / SCK 25 P1.3 / SS 24 P1.2 23 VDD_Micro 22 P1.1 * E-PAD Bottom Side RFBIAS 10 21 P1.0 20 NC 19 RESV 18 NC 17 NC 16 VCC 15 P2.0 14 NC 13 RFN 12 GND 11 RFP Pin Definitions Pin Name 1 P0.4 Individually configured GPIO Description 12 MHz crystal 2 XTAL 3, 7, 16, 40 VCC Connected to 2.7 V to 3.6 V supply, through 0.047 F bypass C. 4 P0.3 Individually configured GPIO 5 P0.1 Individually configured GPIO 6 Vbat1 Connect to 2.7 V to 3.6 V power supply, through 47 ohm series/1 F shunt C 8 P2.1 GPIO. Port 2 Bit 1 9 Vbat2 Connected to 2.7 V to 3.6 V main power supply, through 0.047 F bypass C 10 RFbias RF pin voltage reference 11 RFp Differential RF to or from antenna 12 GND GND 13 RFn Differential RF to or from antenna 14, 17, 18, 20 NC 15 P2.0 19 RESV GPIO 21 P1.0 GPIO 22 P1.1 GPIO 23 VDD_micro 24 P1.2 Reserved. Must connect to GND MCU supply connected to VCC, max CPU 12 MHz GPIO 25 P1.3 / nSS Slave Select 26 P1.4 / SCK SPI Clock 27 IRQ Radio Function Interrupt output, configure High, Low or as Radio GPIO Document Number: 001-66502 Rev. *C Page 5 of 69 CYRF69303 Pin Definitions (continued) Pin Name 28 Description P1.5 / MOSI MOSI pin from microcontroller function to radio function 29 MISO 3-wire SPI mode configured as Radio GPIO. In 4-wire SPI mode sends data to MCU function 30 XOUT Buffered CLK or Radio GPIO 31 NC 32 P1.6 GPIO 33 VIO 2.7 V to 3.6 V to main power supply rail for Radio I/O 34 RST Radio Reset. Connected to VCC with 0.47 F. Must have a RST=HIGH event the very first time power is applied to the radio otherwise the state of the radio control registers is unknown Must be floating 35 P1.7 36 VDD1.8 37 GND Must be connected to ground 38 P0.7 GPIO 39 Vbat0 Connected to 2.7 V to 3.6 V main power supply, through 0.047 F bypass C 41 E-pad Must be connected to ground 42 GPIO Regulated logic bypass. Connected to 0.47 F to GND Corner Tabs Do Not connect corner tabs Functional Block Overview Baseband and Framer All the blocks that make up the PRoC LPstar are presented in this section. The baseband and framer blocks provide the DSSS encoding and decoding, SOP generation and reception and CRC16 generation and checking, and EOP detection and length field. 2.4 GHz Radio Data Transmission Modes and Data Rates The radio transceiver is a dual conversion low IF architecture optimized for power and range/robustness. The radio employs channel matched filters to achieve high performance in the presence of interference. An integrated Power Amplifier (PA) provides up to 0 dBm transmit power, with an output power control range of 30 dB in six steps. The supply current of the device is reduced as the RF output power is reduced. The SoC supports two different data transmission modes: Table 1. Internal PA Output Power Step Table 32 chip Pseudo Noise (PN) codes are supported. The two data transmission modes apply to the data after the SOP. In particular the length, data, and CRC16 are all sent in the same mode. In general, DSSS reduce packet error rate in any environment. PA Setting Typical Output Power (dBm) 6 0 5 -5 4 -10 3 -15 2 -20 1 -25 0 -30 In GFSK mode, data is transmitted at 1 Mbps, without any DSSS. In DSSS mode eight bits (8DR, 32 chip) are encoded in each derived code symbol transmitted, resulting in effective 250 kbps data rate. Link Layer Modes SOP Packets begin with a two-symbol SoP marker. If framing is disabled then an SOP event is inferred whenever two successive correlations are detected. The SOP_CODE_ADR code used for the SOP is different from that used for the "body" of the packet, and if desired may be a different length. SOP must be configured to be the same length on both sides of the link. Frequency Synthesizer Length Before transmission or reception may commence, it is necessary for the frequency synthesizer to settle. The settling time varies depending on channel; 25 fast channels are provided with a maximum settling time of 100 s. Length field is the first eight bits after the SOP symbol, and is transmitted at the payload data rate. An EoP condition is inferred after reception of the number of bytes defined in the length field, plus two bytes for the CRC16. The "fast channels" (<100 s settling time) are every third frequency, starting at 2400 MHz up to and including 2472 MHz (that is, 0,3,6,9.......69 and 72). Document Number: 001-66502 Rev. *C Page 6 of 69 CYRF69303 CRC16 CRC16 detects the following errors: The device may be configured to append a 16-bit CRC16 to each packet. The CRC16 uses the USB CRC polynomial with the added programmability of the seed. If enabled, the receiver verifies the calculated CRC16 for the payload data against the received value in the CRC16 field. The starting value for the CRC16 calculation is configurable, and the CRC16 transmitted may be calculated using either the loaded seed value or a zero seed; the received data CRC16 is checked against both the configured and zero CRC16 seeds. Any one bit in error Any two bits in error (no matter how far apart, which column, and so on) Any odd number of bits in error (no matter where they are) An error burst as wide as the checksum itself Figure 2 shows an example packet with SOP, CRC16 and lengths fields enabled. Figure 2. Example Default Packet Format 2nd Framing Symbol* Preamble N*16us Preamble SOP1 1st Framing Symbol* SOP2 Length <== P a y l o a d ==> CRC 16 Packet length 1 Byte Period *Note: 32 us Packet Buffers and Radio Configuration Registers Packet data and configuration registers are accessed through the SPI interface. All configuration registers are directly addressed through the address field in the SPI packet. Configuration registers are provided to allow configuration of DSSS PN codes, data rate, operating mode, interrupt masks, interrupt status, and others. Packet Buffers All data transmission and reception use the 16-byte packet buffers: one for transmission and one for reception. The transmit buffer allows a complete packet of up to 16 bytes of payload data to be loaded in one burst SPI transaction, and then transmitted with no further MCU intervention. Similarly, the receive buffer allows an entire packet of payload data up to 16 bytes to be received with no firmware intervention required until packet reception is complete. The CYRF69303 IC supports packet length of up to 40 bytes; interrupts are provided to allow an MCU to use the transmit and receive buffers as FIFOs. When transmitting a packet longer than 16 bytes, the MCU can load 16 bytes initially, and add further bytes to the transmit buffer as transmission of data creates space in the buffer. Similarly, when receiving packets longer than 16 bytes, the MCU must fetch received data from the FIFO periodically during packet reception to prevent it from overflowing. Auto Transaction Sequencer (ATS) The CYRF69303 IC provides automated support for transmission and reception of acknowledged data packets. When transmitting a data packet, the device automatically starts the crystal and synthesizer, enters transmit mode, transmits the packet in the transmit buffer, and then automatically switches to receive mode and waits for a handshake packet -- and then Document Number: 001-66502 Rev. *C automatically reverts to sleep mode or idle mode when either an ACK packet is received, or a time out period expires. Similarly, when receiving in transaction mode, the device waits in receive mode for a valid packet to be received, then automatically transitions to transmit mode, transmits an ACK packet, and then switches back to receive mode to await the next packet. The contents of the packet buffers are not affected by the transmission or reception of ACK packets. In each case, the entire packet transaction takes place without any need for MCU firmware action; to transmit data the MCU simply needs to load the data packet to be transmitted, set the length, and set the TX GO bit. Similarly, when receiving packets in transaction mode, firmware simply needs to retrieve the fully received packet in response to an interrupt request indicating reception of a packet. Interrupts The radio function provides an interrupt (IRQ) output, which is configurable to indicate the occurrence of various different events. The IRQ pin may be programmed to be either active high or active low, and be either a CMOS or open drain output. The radio function features three sets of interrupts: transmit, receive, and system interrupts. These interrupts all share a single pin (IRQ), but can be independently enabled/disabled. In transmit mode, all receive interrupts are automatically disabled, and in receive mode all transmit interrupts are automatically disabled. However, the contents of the enable registers are preserved when switching between transmit and receive modes. If more than one radio interrupt is enabled at any time, it is necessary to read the relevant status register to determine which event caused the IRQ pin to assert. Even when an interrupt source is disabled, the status of the condition that would otherwise cause an interrupt can be determined by reading the appropriate status register. It is therefore possible to use the devices without making use of the IRQ pin by polling the status register(s) to wait for an event, rather than using the IRQ pin. Page 7 of 69 CYRF69303 Clocks A 12 MHz crystal (30 ppm or better) is directly connected between XTAL and GND without the need for external capacitors. A digital clock out function is provided, with selectable output frequencies of 0.75, 1.5, 3, 6, or 12 MHz. This output may be used to clock an external microcontroller (MCU) or ASIC. This output is enabled by default, but may be disabled. The requirements for the crystal to be directly connected to XTAL pin and GND are: Nominal Frequency: 12 MHz Operating Mode: Fundamental Mode Resonance Mode: Parallel Resonant Frequency Initial Stability: 30 ppm Series Resistance: <60 ohms Load Capacitance: 10 pF Drive Level: l00 W The MCU function features an internal oscillator. The clock generator provides the 12 MHz and 24 MHz clocks that remain internal to the microcontroller. at the start and at the end of an event, then calculating the difference between the two values. Power Management The operating voltage of the device is 2.7 V to 3.6 V DC, which is applied to VCC and VBAT pins. The device can be shut down to a fully static sleep mode by writing to the FRC END = 1 and END STATE = 000 bits in the XACT_CFG_ADR register over the SPI interface. The device enters sleep mode within 35 s after the last SCK positive edge at the end of this SPI transaction. Alternatively, the device may be configured to automatically enter sleep mode after completing the packet transmission or reception. When in sleep mode, the on-chip oscillator is stopped, but the SPI interface remains functional. The device wakes from sleep mode automatically when the device is commanded to enter transmit or receive mode. When resuming from sleep mode, there is a short delay while the oscillator restarts. The device can be configured to assert the IRQ pin when the oscillator has stabilized. The following Figure 3 is an example of the circuit used when the supply voltage is always above 2.7 V. This could be three 1.5 V battery cells in series along with a linear regulator, or some similar power source. Figure 4 on page 9 shows an example of using an external boost to supply power to the device. GPIO Interface The MCU function features up to 15 general-purpose I/O (GPIO) pins.The I/O pins are grouped into three ports (Port 0 to 2). The pins on Port 0 and Port 1 may each be configured individually while the pins on Port 2 may only be configured as a group. Each GPIO port supports high-impedance inputs, configurable pull-up, open drain output, CMOS/TTL inputs, and CMOS output with up to two pins that support programmable drive strength of up to 50 mA sink current. Additionally, each I/O pin can be used to generate a GPIO interrupt to the microcontroller. Each GPIO port has its own GPIO interrupt vector with the exception of GPIO Port 0. GPIO Port 0 has three dedicated pins that have independent interrupt vectors (P0.1, P0.3-P0.4). Figure 3. Example Circuit - Linear Regulator VCC 0.047F 0.047F 0.047F 0.047F 0.047F 0.047F 0.047F 0.047F VCC1 VCC2 VCC3 VCC4 VIO VBat0 VBat1 The power-on reset (POR) circuit detects logic when power is applied to the device, resets the logic to a known state, and begins executing instructions at Flash address 0x0000. When power falls below a programmable trip voltage, it generates reset or may be configured to generate interrupt. VBat2 Power-on Reset Vcc VDD_MICRO CYRF69303 Timers Document Number: 001-66502 Rev. *C 0.1F GND The free-running 16-bit timer provides two interrupt sources: the programmable interval timer with 1 s resolution and the 1.024 ms outputs. The timer can be used to measure the duration of an event under firmware control by reading the timer Page 8 of 69 CYRF69303 SPI Interface Figure 4. Example Circuit - External Boost Converter VCC VBat External DC-DC Boost Converter 1 Ohm 1% 10F 6.3V 47 Ohm 0.047F Three-Wire SPI Interface 0.047F 1F 6.3V 0.047F 0.047F 0.047F VCC1 VCC2 VCC3 VCC4 VIO VBat0 VBat1 VBat2 0.047F Vcc VDD_MICRO The SPI interface between the MCU function and the radio function is a 3-wire SPI Interface. The three pins are Master Out Slave In (MOSI), Serial Clock (SCK), and Slave Select (SS). There is an alternate 4-wire MISO Interface that requires the connection of two external pins. The SPI interface is controlled by configuring the SPI Configure Register. (SPICR Addr: 0x3D). CYRF69303 GND 0.1F The radio function receives a clock from the MCU function on the SCK pin. The MOSI pin is multiplexed with the MISO pin. Bidirectional data transfer takes place between the MCU function and the radio function through this multiplexed MOSI pin. When using this mode the user firmware must ensure that the MOSI pin on the MCU function is in a high impedance state, except when the MCU is actively transmitting data. Firmware must also control the direction of data flow and switch directions between MCU function and radio function by setting the SWAP bit [Bit 7] of the SPI Configure Register. The SS pin is asserted before initiating a data transfer between the MCU function and the radio function. The IRQ function may be optionally multiplexed with the MOSI pin; when this option is enabled the IRQ function is not available while the SS pin is low. When using this configuration, user firmware must ensure that the MOSI function on MCU function is in a high-impedance state whenever SS is high. MOSI SCK nSS Figure 5. Three-Wire SPI Mode Low Noise Amplifier (LNA) and Received Signal Strength Indication (RSSI) The gain of the receiver may be controlled directly by clearing the AGC EN bit and writing to the low noise amplifier (LNA) bit of the RX_CFG_ADR register. When the LNA bit is cleared, the receiver gain is reduced by approximately 20 dB, allowing accurate reception of very strong received signals (for example when operating a receiver very close to the transmitter). An additional 20 dB of receiver attenuation can be added by setting the Attenuation (ATT) bit; this allows data reception to be limited to devices at very short ranges. Disabling AGC and enabling LNA is recommended unless receiving from a device using external PA. Radio Function MCU Function P1.5/MOSI MOSI/MISO multiplexed on one MOSI pin MOSI P1.4/SCK SCK P1.3/nSS nSS The RSSI register returns the relative signal strength of the on-channel signal power. When receiving, the device may be configured to automatically measure and store the relative strength of the signal being received as a 5-bit value. When enabled, an RSSI reading is taken and may be read through the SPI interface. An RSSI reading is taken automatically when the start of a packet is detected. In addition, a new RSSI reading is taken every time the previous reading is read from the RSSI register, allowing the background RF energy level on any channel to be easily measured when RSSI is read when no signal is being received. A new reading can occur as fast as once every 12 s. Document Number: 001-66502 Rev. *C Four-Wire SPI Interface The four-wire SPI communications interface consists of MOSI, MISO, SCK, and SS. The device receives SCK from the MCU function on the SCK pin. Data from the MCU function is shifted in on the MOSI pin. Data to the MCU function is shifted out on the MISO pin. The active low SS pin must be asserted for the two functions to communicate. The IRQ function may be optionally multiplexed with the MOSI pin; when this option is enabled the IRQ function is not available while the SS pin is low. When using this configuration, user firmware must ensure that the MOSI function on MCU function is in a high-impedance state whenever SS is high. Page 9 of 69 CYRF69303 The INC bit helps to read or write consecutive bytes from contiguous memory locations in a single burst mode operation. If Slave Select is asserted and INC = 0, then the MCU function reads/writes the bytes in the same register in burst mode, but if it is a register file then it reads/writes the bytes in that register file. Radio Function MCU Function P1.6/MISO If Slave Select is asserted and INC = 1, then the master MCU function reads a byte from the radio, the address is incremented by a byte location, and then the byte at that location is read, and so on. nSS MOSI SCK Figure 6. Four-Wire SPI Mode P1.5/MOSI MOSI P1.4/SCK SCK P1.3/nSS nSS MISO The SPI interface between the radio function and the MCU is not dependent on the internal 12 MHz oscillator of the radio. Therefore, radio function registers can be read from or written into while the radio is in sleep mode. SPI I/O Voltage References The SPI interfaces between MCU function and the radio and the IRQ and RST have a separate voltage reference VIO. For CYRF69303 VIO is normally set to VCC. SPI Connects to External Devices This connection is external to the PRoC LPstar Chip SPI Communication and Transactions The SPI transactions can be single byte or multi-byte. The MCU function initiates a data transfer through a Command/Address byte. The following bytes are data bytes. The SPI transaction format is shown in Figure 5. The three SPI wires, MOSI, SCK, and SS are also drawn out of the package as external pins to allow the user to interface their own external devices (such as optical sensors and others) through SPI. The radio function also has its own SPI wires MISO and IRQ, which can be used to send data back to the MCU function or send an interrupt request to the MCU function. They can also be configured as GPIO pins. The DIR bit specifies the direction of data transfer. 0 = Master reads from slave. 1 = Master writes to slave. Table 2. SPI Transaction Format Byte 1 Bit # Bit Name Byte 1+N 7 6 [5:0] [7:0] DIR INC Address Data Document Number: 001-66502 Rev. *C Page 10 of 69 CYRF69303 CPU Architecture The Accumulator Register (CPU_A) is the general-purpose register that holds the results of instructions that specify any of the source addressing modes. This family of microcontrollers is based on a high-performance, 8-bit, Harvard architecture microprocessor. Five registers control the primary operation of the CPU core. These registers are affected by various instructions, but are not directly accessible through the register space by the user. The Index Register (CPU_X) holds an offset value that is used in the indexed addressing modes. Typically, this is used to address a block of data within the data memory space. The Stack Pointer Register (CPU_SP) holds the address of the current top-of-stack in the data memory space. It is affected by the PUSH, POP, LCALL, CALL, RETI, and RET instructions, which manage the software stack. It can also be affected by the SWAP and ADD instructions. Table 3. CPU Registers and Register Name Register Register Name Flags CPU_F Program Counter CPU_PC Accumulator CPU_A Stack Pointer CPU_SP Index CPU_X The Flag Register (CPU_F) has three status bits: Zero Flag bit [1]; Carry Flag bit [2]; Supervisory State bit [3]. The Global Interrupt Enable bit [0] is used to globally enable or disable interrupts. The user cannot manipulate the Supervisory State status bit [3]. The flags are affected by arithmetic, logic, and shift operations. The manner in which each flag is changed is dependent upon the instruction being executed (for example, AND, OR, XOR). See Table 20 on page 16. The 16-bit Program Counter Register (CPU_PC) allows for direct addressing of the full eight Kbytes of program memory space. CPU Registers Flags Register The Flags Register can only be set or reset with logical instruction. Table 4. CPU Flags Register (CPU_F) [R/W] Bit # 7 Field 6 5 4 3 2 1 0 XIO Super Carry Zero Global IE Read/Write - Reserved - - R/W R RW RW RW Default 0 0 0 0 0 0 1 0 Bits 7:5 Bit 4 Reserved XIO Set by the user to select between the register banks. 0 = Bank 0 1 = Bank 1 Bit 3 Super Indicates whether the CPU is executing user code or Supervisor Code (This code cannot be accessed directly by the user). 0 = User Code 1 = Supervisor Code Bit 2 Carry Set by CPU to indicate whether there has been a carry in the previous logical/arithmetic operation. 0 = No Carry 1 = Carry Bit 1 Zero Set by CPU to indicate whether there has been a zero result in the previous logical/arithmetic operation. 0 = Not Equal to Zero 1 = Equal to Zero Bit 0 Global IE Determines whether all interrupts are enabled or disabled. 0 = Disabled 1 = Enabled Note This register is readable with explicit address 0xF7. The OR F, expr and AND F, expr must be used to set and clear the CPU_F bits. Document Number: 001-66502 Rev. *C Page 11 of 69 CYRF69303 Accumulator Register Table 5. CPU Accumulator Register (CPU_A) Bit # 7 6 5 Field 4 3 2 1 0 CPU Accumulator [7:0] Read/Write - - - - - - - - Default 0 0 0 0 0 0 0 0 Bits 7:0 CPU Accumulator [7:0] 8-bit data value holds the result of any logical/arithmetic instruction that uses a source addressing mode. Index Register Table 6. CPU X Register (CPU_X) Bit # 7 6 5 4 Field 3 2 1 0 X [7:0] Read/Write - - - - - - - - Default 0 0 0 0 0 0 0 0 2 1 0 Bits 7:0 X [7:0] 8-bit data value holds an index for any instruction that uses an indexed addressing mode. Stack Pointer Register Table 7. CPU Stack Pointer Register (CPU_SP) Bit # 7 6 5 4 Field 3 Stack Pointer [7:0] Read/Write - - - - - - - - Default 0 0 0 0 0 0 0 0 4 3 2 1 0 Bits 7:0 Stack Pointer [7:0] 8-bit data value holds a pointer to the current top-of-stack. CPU Program Counter High Register Table 8. CPU Program Counter High Register (CPU_PCH) Bit # 7 6 5 Field Program Counter [15:8] Read/Write - - - - - - - - Default 0 0 0 0 0 0 0 0 4 3 2 1 0 Bits 7:0 Program Counter [15:8] 8-bit data value holds the higher byte of the program counter. CPU Program Counter Low Register Table 9. CPU Program Counter Low Register (CPU_PCL) Bit # 7 6 5 Field Program Counter [7:0] Read/Write - - - - - - - - Default 0 0 0 0 0 0 0 0 Bit 7:0 Program Counter [7:0] 8-bit data value holds the lower byte of the program counter. Document Number: 001-66502 Rev. *C Page 12 of 69 CYRF69303 Addressing Modes Source Indexed Examples of the different addressing modes are discussed in this section and example code is given. Source Immediate The result of an instruction using this addressing mode is placed in the A register, the F register, the SP register, or the X register, which is specified as part of the instruction opcode. Operand 1 is an immediate value that serves as a source for the instruction. Arithmetic instructions require two sources. Instructions using this addressing mode are two bytes in length. The result of an instruction using this addressing mode is placed in either the A register or the X register, which is specified as part of the instruction opcode. Operand 1 is added to the X register forming an address that points to a location in either the RAM memory space or the register space that is the source for the instruction. Arithmetic instructions require two sources; the second source is the A register or X register specified in the opcode. Instructions using this addressing mode are two bytes in length. Table 12. Source Indexed Opcode Table 10. Source Immediate Opcode Operand 1 Instruction Immediate Value Examples ADD A, Source Index Examples ADD A, [X+7] 7 In this case, the immediate value of 7 is added with the Accumulator, and the result is placed in the Accumulator. MOV X, 8 In this case, the immediate value of 8 is moved to the X register. AND F, 9 In this case, the immediate value of 9 is logically ANDed with the F register and the result is placed in the F register. Source Direct The result of an instruction using this addressing mode is placed in either the A register or the X register, which is specified as part of the instruction opcode. Operand 1 is an address that points to a location in either the RAM memory space or the register space that is the source for the instruction. Arithmetic instructions require two sources; the second source is the A register or X register specified in the opcode. Instructions using this addressing mode are two bytes in length. Examples ADD A, X, In this case, the value in the memory location at address X + 7 is added with the Accumulator, and the result is placed in the Accumulator. REG[X+8] In this case, the value in the register space at address X + 8 is moved to the X register. Destination Direct The result of an instruction using this addressing mode is placed within either the RAM memory space or the register space. Operand 1 is an address that points to the location of the result. The source for the instruction is either the A register or the X register, which is specified as part of the instruction opcode. Arithmetic instructions require two sources; the second source is the location specified by Operand 1. Instructions using this addressing mode are two bytes in length. Table 13. Destination Direct Operand 1 Destination Address Operand 1 Source Address [7] X, Instruction Opcode Instruction MOV Opcode Table 11. Source Direct MOV Operand 1 Instruction Examples ADD [7], A In this case, the value in the memory location at address 7 is added with the Accumulator, and the result is placed in the memory location at address 7. The Accumulator is unchanged. A In this case, the Accumulator is moved to the register space location at address 8. The Accumulator is unchanged. In this case, the value in the RAM memory location at address 7 is added with the Accumulator, and the result is placed in the Accumulator. REG[8] In this case, the value in the register space at address 8 is moved to the X register. Document Number: 001-66502 Rev. *C MOV REG[8], Page 13 of 69 CYRF69303 Destination Indexed Destination Indexed Source Immediate The result of an instruction using this addressing mode is placed within either the RAM memory space or the register space. Operand 1 is added to the X register forming the address that points to the location of the result. The source for the instruction is the A register. Arithmetic instructions require two sources; the second source is the location specified by Operand 1 added with the X register. Instructions using this addressing mode are two bytes in length. The result of an instruction using this addressing mode is placed within either the RAM memory space or the register space. Operand 1 is added to the X register to form the address of the result. The source for the instruction is Operand 2, which is an immediate value. Arithmetic instructions require two sources; the second source is the location specified by Operand 1 added with the X register. Instructions using this addressing mode are three bytes in length. Table 14. Destination Indexed Table 16. Destination Indexed Source Immediate Opcode Instruction Example ADD [X+7], Operand 1 Destination Index A In this case, the value in the memory location at address X+7 is added with the Accumulator, and the result is placed in the memory location at address x+7. The Accumulator is unchanged. Opcode Instruction MOV Table 15. Destination Direct Source Immediate Opcode Instruction Examples ADD [7], MOV REG[8], Operand 1 Destination Address Operand 2 Immediate Value REG[X+8], 6 In this case, value in the memory location at address 7 is added to the immediate value of 5, and the result is placed in the memory location at address 7. In this case, the immediate value of 6 is moved into the register space location at address 8. Document Number: 001-66502 Rev. *C Operand 2 Immediate Value 5 In this case, the value in the memory location at address X+7 is added with the immediate value of 5 and the result is placed in the memory location at address X+7. 6 In this case, the immediate value of 6 is moved into the location in the register space at address X+8. Destination Direct Source Direct The result of an instruction using this addressing mode is placed within the RAM memory. Operand 1 is the address of the result. Operand 2 is an address that points to a location in the RAM memory that is the source for the instruction. This addressing mode is only valid on the MOV instruction. The instruction using this addressing mode is three bytes in length. Table 17. Destination Direct Source Direct Opcode 5 Destination Index Examples ADD [X+7], Destination Direct Source Immediate The result of an instruction using this addressing mode is placed within either the RAM memory space or the register space. Operand 1 is the address of the result. The source for the instruction is Operand 2, which is an immediate value. Arithmetic instructions require two sources; the second source is the location specified by Operand 1. Instructions using this addressing mode are three bytes in length. Operand 1 Instruction Example MOV [7], Operand 1 Destination Address Operand 2 Source Address [8] In this case, the value in the memory location at address 8 is moved to the memory location at address 7. Page 14 of 69 CYRF69303 Source Indirect Post Increment Destination Indirect Post Increment The result of an instruction using this addressing mode is placed in the Accumulator. Operand 1 is an address pointing to a location within the memory space, which contains an address (the indirect address) for the source of the instruction. The indirect address is incremented as part of the instruction execution. This addressing mode is only valid on the MVI instruction. The instruction using this addressing mode is two bytes in length. Refer to the PSoC Designer: Assembly Language User Guide for further details on MVI instruction. The result of an instruction using this addressing mode is placed within the memory space. Operand 1 is an address pointing to a location within the memory space, which contains an address (the indirect address) for the destination of the instruction. The indirect address is incremented as part of the instruction execution. The source for the instruction is the Accumulator. This addressing mode is only valid on the MVI instruction. The instruction using this addressing mode is two bytes in length. Table 19. Destination Indirect Post Increment Table 18. Source Indirect Post Increment Opcode Instruction Example MVI A, Operand 1 Opcode Instruction Operand 1 Destination Address Address Source Address Address Example MVI [8], [8] In this case, the value in the memory location at address 8 is an indirect address. The memory location pointed to by the indirect address is moved into the Accumulator. The indirect address is then incremented. Document Number: 001-66502 Rev. *C A In this case, the value in the memory location at address 8 is an indirect address. The Accumulator is moved into the memory location pointed to by the indirect address. The indirect address is then incremented. Page 15 of 69 CYRF69303 Instruction Set Summary The instruction set is summarized in Table 20 numerically and serves as a quick reference. If more information is needed, the Instruction Set Summary tables are described in detail in the PSoC Designer Assembly Language User Guide (available on www.cypress.com). Cycles Bytes Opcode Hex Cycles Bytes Opcode Hex Cycles Bytes Opcode Hex Table 20. Instruction Set Summary Sorted Numerically by Opcode Order[1, 2] 00 15 1 SSC 2D 8 2 OR [X+expr], A Z 5A 5 2 MOV [expr], X 01 4 2 ADD A, expr C, Z 2E 9 3 OR [expr], expr Z 5B 4 1 MOV A, X 02 6 2 ADD A, [expr] C, Z 2F 10 3 OR [X+expr], expr Z 5C 4 1 MOV X, A 03 7 2 ADD A, [X+expr] C, Z 30 9 1 HALT 5D 6 2 MOV A, reg[expr] Z 04 7 2 ADD [expr], A C, Z 31 4 2 XOR A, expr Z 5E 7 2 MOV A, reg[X+expr] Z 05 8 2 ADD [X+expr], A C, Z 32 6 2 XOR A, [expr] Z 5F 10 3 MOV [expr], [expr] 06 Instruction Format Flags Instruction Format Flags Instruction Format Flags Z 9 3 ADD [expr], expr C, Z 33 7 2 XOR A, [X+expr] Z 60 5 2 MOV reg[expr], A 07 10 3 ADD [X+expr], expr C, Z 34 7 2 XOR [expr], A Z 61 6 2 MOV reg[X+expr], A 08 4 1 PUSH A 35 8 2 XOR [X+expr], A Z 62 8 3 MOV reg[expr], expr 09 4 2 ADC A, expr C, Z 36 9 3 XOR [expr], expr Z 63 9 3 MOV reg[X+expr], expr 0A 6 2 ADC A, [expr] C, Z 37 10 3 XOR [X+expr], expr Z 64 4 1 ASL A C, Z 0B 7 2 ADC A, [X+expr] C, Z 38 5 2 ADD SP, expr 65 7 2 ASL [expr] C, Z 0C 7 2 ADC [expr], A C, Z 39 5 2 CMP A, expr 8 2 ASL [X+expr] C, Z 0D 8 2 ADC [X+expr], A C, Z 3A 7 2 CMP A, [expr] if (A=B) Z=1 66 if (A