Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Si4432 V1.0 RF MODULE interfacing with PIC MCU thru' SPI

Status
Not open for further replies.

speedEC

Full Member level 6
Joined
Apr 1, 2011
Messages
337
Helped
23
Reputation
46
Reaction score
21
Trophy points
1,298
Activity points
4,324
Dear all,

I need to interface Silicon Labs Si4432 v1.0 Module with PIC16F1938 thru' SPI module. I could not able to receive signal from Si4432.

The settings are follows:

Si4432 V1.0 RF MODULE: SILICON LABS
MCU - PIC16F1938 - 8 BIT MCU

HARDW(A)IRES CONNECTION:

GND - GND
GPIO_0 - 0 V - UNCONNECTED TO MCU
GPIO_1 - 2.90 V - UNCONNECTED TO MCU
GPIO_2 - 1.42 V - UNCONNECTED TO MCU
VDD - 2.90V (2 AA BATTERY)
SDO - 0V - CONNECTED TO MCU'S SDI
SDI - 0V - CONNECTED TO MCU'S SDO
SCLK - 0V - CONNECTED TO MCU'S SCLK
nSEL - 0V - CONNECTED TO MCU'S DIG I/O PIN
nIRQ - 0V - CONNECTED TO MCU'S INTERRUPT PIN
SDN - GND - Always ON
GND - GND

MCU:

1. RB0 - SET AS INPUT (TRISB0 = 1) for nIRQ interrupt
2. RC4 - SET AS INPUT (TRISC4 = 1) for SDI

3. MCU internal clock - 4 MHz
4. INTIE and SSPIE interrupts enabled and GIE set

SW CODE:

init SPI Module:


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
void init_SSP_Module(){
 SSPIE = 1;
 SSPIF = 0;
    
 // SSP STATUS Register
 SSPSTAT = 10000000; // 8 - SMP -> SPI data input sample bit - 1 = Input data sampled at end of       
                                //data output time
                                // 7 - CKE: SPI Clock Edge Select bit - 0 = Transmit occurs on transition from 
                                // Idle to active clock state
                        // 6-0 - USED FOR I2C ONLY
 
// SSP CONTROL 1 Register
SSPCON1 = 00100000; // 76 - READ ONLY 
            // 5 - SSPEN: Synchronous Serial Port Enable bit
            // 4 - CKP: Clock Polarity Select bit - 0 = Idle state for clock is a low level
            // SSPM<3:0>: Synchronous Serial Port Mode Select bits
            // 0000 = SPI Master mode, clock = FOSC/4
SSPCON3 = 00000000;     // 765 - READ ONLY
                        // 4 - BOEN: Buffer Overwrite Enable bit
            // 0123 - READ ONLY
RC2 = 1;            // pull nSEL (Si4432) pin High
 
}



Reading Si4432:

1. char ItStatus1;
2. ItStatus1 = SpiReadRegister(0x03); //read the Interrupt Status1 register


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
char SpiReadRegister (char reg)
{
RC2 = 0;      // set nSEL low
SSPBUF = reg; //write data into the SPI register;
while(SSPIF == 0);
 
SSPIF = 0;
SSPBUF = 0xFF; //write dummy data into the SPI register
while(SSPIF == 0);
 
SSPIF = 0;
 
RC2 = 1;
return SSPBUF;
}



Si4432 - Serial Peripheral Interface (SPI)

The Si4430/31/32 communicates with the host MCU over a standard 3-wire SPI interface: SCLK, SDI, and nSEL. The host MCU can read data from the device on the SDO output pin. A SPI transaction is a 16-bit sequence which consists of a Read-Write (R/W) select bit, followed by a 7-bit address field (ADDR), and an 8-bit data field (DATA) as demonstrated in Figure 3. The 7-bit address field is used to select one of the 128, 8-bit control registers. The R/W select bit determines whether the SPI transaction is a read or write transaction. If R/W = 1 it signifies a WRITE transaction, while R/W = 0 signifies a READ transaction. The contents (ADDR or DATA) are latched into the Si4430/31/32 every eight clock cycles. The timing parameters for the SPI interface are shown in Table 10. The SCLK rate is flexible with a maximum rate of 10 MHz.

any help?

thanks
pmk
 

Attachments

  • Si4432-chip-SPI-wireless-transceiver.jpg
    Si4432-chip-SPI-wireless-transceiver.jpg
    117.5 KB · Views: 99
  • Si4430-31-32.pdf
    2.2 MB · Views: 69

Added:

Silicon Labs' example code for reading Si4432: They have used C8501F93X MCU to communicate with Si4432.

They set:

CKPHA = 0; // CLOCK PHASE -> data centered on first edge of SCK period
CKPOL = 0; // POLARITY -> SCK line is low in idle state

NSS pin connected to nSEL pin of Si4432 RF (it is like SS pin in MCU to read/write SPI)

I set as:

CKE = 0; // Transmit occurs on transition from Idle to active clock state (rising edge)
CKP = 0; // Polarity -> SCK line is low in idle state
SMP = 1; // 1 = Input data sampled at end of data output time

I am receiving some data. I don't know whether it is valid data. But, I don't know the register settings of Si4432.

on Module 30 MHz clock used. Module works fine. But I could not able to read thru' SPI.

Also SCK timing is different in both datasheet. i.e PIC16F1938 and C8501F93X.

Any idea?

thanks
pmk
 

Attachments

  • SiliconLabs_sampleCode.png
    SiliconLabs_sampleCode.png
    19.3 KB · Views: 138
  • PIC16F1938_SPI_SCK.png
    PIC16F1938_SPI_SCK.png
    37.6 KB · Views: 100
  • C8501F93X_ SPI_1.png
    C8501F93X_ SPI_1.png
    45.7 KB · Views: 90
  • C8501F93X_ SPI_2.png
    C8501F93X_ SPI_2.png
    51.2 KB · Views: 94
  • C8501F93X_ SPI_SCK.png
    C8501F93X_ SPI_SCK.png
    16.5 KB · Views: 95

Problem with hardware. Solved the problem. It works fine now.

thanks
pmk
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top