Tool/software: TI C/C++ Compiler
So the problem statement is to send a character to Arduino Uno via SPI while CC2530 is acting as SPI master .
The pins I am using are USART 0, Alt. 2 for the connections on hardware .
#define A88_SPI_TX(x) { U0CSR &= ~(BV(2) | BV(1)); U0DBUF = x; while( !(U0CSR & BV(1)) ); }
#define A88_SPI_WAIT_RXRDY() { while(!(U0CSR & BV(1))); }
Now this works for sending data and i can see tha characters coming on serial output of Arduino Uno(Slave). What i fail to see is that U0DBUF register always show 0 in "register" window which is weird.
//deeplyembedded.org/.../ #include <SPI.h> volatile boolean process_it; //Flag for checking if the data is recieved from Master i.e. ESP8266 char a; //Byte to store the processed data void setup(void) { Serial.begin(115200); //Set UART baug rate to 115200 SPCR |= bit(SPE); //Configure ATMEGA328P/Arduino in slave mode pinMode(MISO, OUTPUT); //Configure MISO as output, SlaveOut process_it = false; //Initialize flag to FALSE SPI.attachInterrupt(); //Enable interrupts for SPI--> You can do that like this too /*SPCR |= bit (SPIE)*/ } // SPI interrupt routine ISR(SPI_STC_vect) { char c = SPDR; //Grab the data byte from the SPI Data Register (SPDR) a = c; //Put the byte into a temporary variable for processing SPDR = c * 2; //process the data byte and put it back into the SPDR for the Master to read it process_it = true; //Set the Flag as TRUE Serial.print(a); } void loop(void) { if (process_it) //Check if the data has been processed { //Serial.println("Recieved\r\n"); //UART - Notify if recived a byte from master process_it = false; //Set the Flag to False } }
The other , bigger issue is that I am not able to configure processing of data coming from SPI slave .
I am using lcd library style functions .
Any help would be appreciated.
Thanks