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.

[ARM] Issue with reading response bytes from Si4455

Status
Not open for further replies.

SerenityIce

Newbie level 2
Joined
Aug 5, 2016
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
66
Hi,

I am trying to configure a Si4455 RF chip from TICC3200 using SPI, and having a bit of trouble with getting the appropriate response from the Si4455.

I have done the following and also followed the sequence as explained in datasheet, to read response from the Si4455. As mentioned in the datasheet w.r.t Fig(1) below, i.e. Make CS low send API command followed parameters depending on the command, once this transaction is over make CS high.

SPIWrite.png

And I have also ported functions from the example that performs the read operations as shown in the Fig's below.

FFbCo.png

I have ported functions from SiliconLabs Si4455 demo examples to be compatible with CC3200, which sends command as well as reads response bytes from Si455,

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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
unsigned char GetResponse_CTS(unsigned char bytecount, unsigned char *pData)
{
    cts_flag = 0;
    unsigned int errcnt;
    errcnt = RADIO_CTS_TIMEOUT;
    unsigned char cts_byte=0;
    unsigned char cts_check_cmd = 0x44;  //CTS Command
 
    while(errcnt!=0)
            {
                MAP_SPICSEnable(GSPI_BASE); //Enable CS
                MAP_SPITransfer(GSPI_BASE,&cts_check_cmd,0,1,0);  //Send CTS
                MAP_SPITransfer(GSPI_BASE,0,&cts_byte,1,0);   //Get 0xFF
                if(cts_byte == 0xFF)
                {
                    if(bytecount)   //If need to further read response bytes
                    {
                        MAP_SPITransfer(GSPI_BASE,0,pData,bytecount,0);
 
                    }
                    MAP_SPICSDisable(GSPI_BASE);  //Disable CS after reads
                    break;
                }
                MAP_SPICSDisable(GSPI_BASE); //Disable CS after getting 0xFF
                errcnt--;
            }
 
    if(errcnt == 0)
    {
        while(1)
        {
            Message("CTS Time Out \r\n");
        }
    }
    if(cts_byte == 0xFF)
    {
        cts_flag = 1;
 
    }
    return cts_byte;
 
}
 
//Poll CTS and return CTS response
unsigned char PollCTS()
{
    return GetResponse_CTS(0,0);
}
 
//Transfer a byte to Si4455 from CC3200
void SpiWriteByte(unsigned char byteToWrite)
{
    MAP_SPITransfer(GSPI_BASE,&byteToWrite,0,1,0);
}
 
 
 
 void SendCmds(unsigned char ByteCount, unsigned char* pData)
{
    while(!cts_flag)
    {
        PollCTS();
    }
    MAP_SPICSEnable(GSPI_BASE);
    MAP_SPITransfer(GSPI_BASE,pData,0,ByteCount,0);
    MAP_SPICSDisable(GSPI_BASE);
    cts_flag=0;
}
 
 //Send commands and get response for Si4455
  unsigned char SendCmdGetResp(unsigned char cmdByteCount, unsigned char *pCmdData, unsigned char respByteCount, unsigned char* pRespData)
{
    SendCmds(cmdByteCount, pCmdData);
    return GetResponse_CTS(respByteCount, pRespData);
}
 
//Write Configuration array to Si4455
void WriteEZConfigArray(unsigned char numBytes, const unsigned char* pEzConfigArray)
 {
 WriteData(SI4455_CMD_ID_WRITE_TX_FIFO, 1, numBytes, pEzConfigArray);
 
 }
 
 
//Write Command and Data to Si4455
void WriteData(unsigned char cmd, unsigned char pollcts, unsigned char ByteCount, const unsigned char *pData)
 {
 if(pollcts)
 {
 while(!cts_flag)
 {
 PollCTS();
 }
 }
 MAP_SPICSEnable(GSPI_BASE);
 SpiWriteByte(cmd);
 MAP_SPITransfer(GSPI_BASE,(unsigned char*)pData,0,ByteCount,0);
 MAP_SPICSDisable(GSPI_BASE);
 
 cts_flag = 0;
 }



The below is the main function SendCmdGetResp, which sends a GET_INT_STATUS command i.e. 0x20 followed by 3 parameters. .Then it makes CS low and checks for CTS, if positive, it sends 8 dummy bytes to read the response bytes from Si4455. Once this transaction is over, the CS is pulled back high.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void GetIntStatus(unsigned char PH_CLR_PEND,unsigned char MODEM_CLR_PEND, unsigned char CHIP_CLR_PEND)
{
    radioCmd[0] = SI4455_CMD_ID_GET_INT_STATUS;   //0x20 command
    radioCmd[1] = PH_CLR_PEND;         //parambyte0
    radioCmd[2] = MODEM_CLR_PEND;     //parambyte1
    radioCmd[3] = CHIP_CLR_PEND;      //parambyte2
 
   //SI4455_CMD_ARG_COUNT_GET_INT_STATUS = 4 (send 4 bytes)
   //SI4455_CMD_REPLY_COUNT_GET_INT_STATUS = 8 (read 8 response bytes)
 
    SendCmdGetResp(SI4455_CMD_ARG_COUNT_GET_INT_STATUS, radioCmd, SI4455_CMD_REPLY_COUNT_GET_INT_STATUS, radioCmd);
 
    Si4455Cmd.GET_INT_STATUS.INT_PEND       = radioCmd[0];
    Si4455Cmd.GET_INT_STATUS.INT_STATUS     = radioCmd[1];
    Si4455Cmd.GET_INT_STATUS.PH_PEND        = radioCmd[2];
    Si4455Cmd.GET_INT_STATUS.PH_STATUS      = radioCmd[3];
    Si4455Cmd.GET_INT_STATUS.MODEM_PEND     = radioCmd[4];
    Si4455Cmd.GET_INT_STATUS.MODEM_STATUS   = radioCmd[5];
    Si4455Cmd.GET_INT_STATUS.CHIP_PEND      = radioCmd[6];
    Si4455Cmd.GET_INT_STATUS.CHIP_STATUS    = radioCmd[7];
}



Even after looking into details and making respective changes, I still receive the read response bytes as 0xFF. I have read the explanation and have carefully made the respective changes, yet the response is 0xFF. Please, it would be of great help, if folks can check on my code and advise me if I have missed anything, I have cross check it and don't find anything wrong.

The below is the function that is responsible for transferring configuration data to the Si4455. All its supporting functions are above.

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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*Initialize the Si4455 by loading all the configuration properties into it
 * @ Param *pSetPropCmd : Bytes from the patch and radio config files
 */
unsigned char Si4455_Configure(const unsigned char *pSetPropCmd)
    {
        unsigned char col;
        unsigned char response;
        unsigned char numOfBytes;
 
        /* While cycle as far as the pointer points to a command */
            while (*pSetPropCmd != 0x00)
            {
                cts_flag=0;
                /* Commands structure in the array:
                * --------------------------------
                * LEN | <LEN length of data>
                */
                numOfBytes = *pSetPropCmd++;
 
                if (numOfBytes > 16u)
                {
                    /* Initial configuration of Si4x55 */
                    if (SI4455_CMD_ID_WRITE_TX_FIFO == *pSetPropCmd)
                    {
                        if (numOfBytes > 128u)
                        {
                            /* Number of command bytes exceeds maximal allowable length */
                            return SI4455_COMMAND_ERROR;
                        }
 
                        /* Load array to the device */
                        pSetPropCmd++;
                        WriteEZConfigArray(numOfBytes-1, pSetPropCmd);
 
                        /* Point to the next command */
                        pSetPropCmd += numOfBytes - 1;
 
                        /* Continue command interpreter */
                        continue;
                    }
                    else
                    {
                        /* Number of command bytes exceeds maximal allowable length */
                        return SI4455_COMMAND_ERROR;
                    }
                }
 
                for (col = 0u; col < numOfBytes; col++)
                {
                    radioCmd[col] = *pSetPropCmd;
                    pSetPropCmd++;
                }
                if(SendCmdGetResp(numOfBytes,radioCmd,1,&response)!=0xFF)
                {
                    /* Timeout occured */
                    return SI4455_CTS_TIMEOUT;
                }
 
                /* Check response byte of EZCONFIG_CHECK command */
                if (SI4455_CMD_ID_EZCONFIG_CHECK == radioCmd[0])
                {
                    if (response)
                    {
                        /* Number of command bytes exceeds maximal allowable length */
                        return SI4455_COMMAND_ERROR;
                    }
                }
 
                /* Get and clear all interrupts.  An error has occured... */
                    GetIntStatus(0, 0, 0);
                    if (Si4455Cmd.GET_INT_STATUS.CHIP_PEND & SI4455_CMD_GET_CHIP_STATUS_REP_CMD_ERROR_PEND_MASK)
                    {
                        return SI4455_COMMAND_ERROR;
                    }
            }
 
            return SI4455_SUCCESS;
        }



Please Help!
 
Last edited by a moderator:

Problem solved. It was a programming bug!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top