This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2530: not able to configure SPI multiple slave for cc2530 on SmartRF05 board

Part Number: CC2530
Other Parts Discussed in Thread: CC253

Hello,

I am working on SPI where my CC253 is a master & has 2 slave device connected (ADE7953 Energy monitoring & M95M01 EEPROM). 

If i connect the Energy monitoring slave to the SPI separately it works perfect, same if i connect EEPROM slave Separately it also works as expected.

I am finding difficult to solve the issue if i connect both slave on same SPI bus with different slave select pins. In this case i am able to read data from one slave i.e. energy monitoring but the data is not able to read from EEPROM.

#define HAL_CONFIG_IO_INPUT(port, pin) HAL_CONFIG_IO_INPUT_PREP(port, pin)
#define HAL_CONFIG_IO_INPUT_PREP(port, pin) st( P##port##SEL &= ~BV(pin); \
P##port##DIR &= ~BV(pin);\
P##port##INP &= ~BV(pin);)

//Below is actual SPI initialization

PERCFG |= 0x02;

/* Configure clk, master out and master in lines */
HAL_CONFIG_IO_PERIPHERAL(HAL_M95M01_SPI_PORT, HAL_ADE7953_MOSI_PIN);
HAL_CONFIG_IO_PERIPHERAL(HAL_M95M01_SPI_PORT, HAL_ADE7953_MISO_PIN);
HAL_CONFIG_IO_PERIPHERAL(HAL_M95M01_SPI_PORT, HAL_ADE7953_SCK_PIN);

/* Set SPI speed to 1 MHz (the values assume system clk of 32MHz)
* Confirm on board that this results in 1MHz spi clk.
*/
baud_exponent = 11; // Baud Rate of 11,5200 Used
baud_mantissa = 216; //Need to check the calculations

/* Configure SPI */
U1UCR = 0x80; /* Flush and goto IDLE state. 8-N-1. */
U1CSR = 0x00; /* SPI mode, master. */
U1GCR = HAL_ADE7953_SPI_TRANSFER_MSB_FIRST | HAL_ADE7953_SPI_CLOCK_PHA_0 | HAL_ADE7953_SPI_CLOCK_POL_LO | baud_exponent;
U1BAUD = baud_mantissa;
P2SEL &= ~0x20; //Assign Priority to SPI

U1CSR |= 0x40; // RX Enabled only after initialization of SPI

  • Hi akshay,

    Seems like you are basing your code off of the hal_lcd.c file, which is a good place to start.
    Since SPI is successful for each slave separately using the same configuration settings, we can assume that the SPI configuration itself is correct.

    Can you successfully send commands to both slaves?
    Please check the lines with a logic analyzer and send us a screenshot for further analysis.


    Regards,
    Toby