Other Parts Discussed in Thread: Z-STACK
Hello Everyone,
I am using Z-Stack HA, here I need to do SPI Communication between two controllers, I have tried it with using SPI on UART1 by disabling HAL_LCD, but I am unable to achieve the communication also i am not getting the required clock.
Can anyone help me with the Sample code for the same.
I have attached my code here.
static void SPI_Init(void)
{
PERCFG |= BV(1);
P1SEL |= BV(6);
P1SEL |= BV(5);
P1SEL |= BV(4);
P1SEL |= BV(7);
P1DIR |= BV(6);
P1DIR |= BV(5);
P1DIR |= BV(4);
P1DIR &= ~BV(7);
P2SEL &= ~0x20;
U1GCR = 11;
U1BAUD = 216;
U1CSR = 0x00;
U1UCR = 0x00;
U1GCR = 0x00;
U1GCR |= BV(5);
U1GCR |= BV(4);
U1CSR |= 0x40;
}
static void SPI_TX_Data(void)
{
U1DBUF = data;
while( !(U1CSR & BV(1)) );
}