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