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.

Compiler/CC2530: Problem with inter MCU communication using SPI with CC2530 as master and Attiny/ Arduino Uno as slave

Part Number: CC2530


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 

  • Can you please clarify what SPI library you are using for the CC2530? Are you sure that this SPI initialization/control uses the intended peripheral and pin orientation? Oscilloscope or logic analyzer screenshots of the SPI lines are always helpful for debugging communication protocol.

    Regards,
    Ryan
  • I have used hal_lcd.c and modified it like :

    /**************************************************************************************************
      Filename:       hal_88.c
      Revised:        $Date: 2012-09-30 16:36:36 -0700 (Sun, 30 Sep 2012) $
      Revision:       $Revision: 31658 $
    
      Description:    This file contains the interface to the HAL LCD Service.
    
    /**************************************************************************************************
     *                                           INCLUDES
     **************************************************************************************************/
    #include "hal_types.h"
    #include "hal_88.h"
    #include "OSAL.h"
    #include "OnBoard.h"
    #include "hal_assert.h"
    
    #if defined (ZTOOL_P1) || defined (ZTOOL_P2)
      #include "DebugTrace.h"
    #endif
    
    /**************************************************************************************************
     *                                          CONSTANTS
     **************************************************************************************************/
    /*
      LCD pins
    
      //control
      P0.0 - LCD_MODE
      P1.1 - LCD_FLASH_RESET
      P1.2 - LCD_CS
    
      //spi
      P1.5 - CLK
      P1.6 - MOSI
      P1.7 - MISO
    */
    
    /* Attiny 88 pins:
       Control
       P0.2 - MISO
       P0.3 - MOSI
       P0.4 - CS
       P0.5 - CLK
    
    */
    
    /* LCD Control lines 
    #define HAL_LCD_MODE_PORT 0
    #define HAL_LCD_MODE_PIN  0
    
    #define HAL_LCD_RESET_PORT 1
    #define HAL_LCD_RESET_PIN  1
    
    #define HAL_LCD_CS_PORT 1
    #define HAL_LCD_CS_PIN  2
    */
    
    /* 88 Control lines */
    
    #define HAL_88_RESET_PORT 1//to be defined
    #define HAL_88_RESET_PIN  1//to be defined 
    
    #define HAL_88_MODE_PORT 0//not needed
    #define HAL_88_MODE_PIN  0
    
    #define HAL_88_CS_PORT 0
    #define HAL_88_CS_PIN  4
    
    
    /* LCD SPI lines 
    #define HAL_LCD_CLK_PORT 1
    #define HAL_LCD_CLK_PIN  5
    
    #define HAL_LCD_MOSI_PORT 1
    #define HAL_LCD_MOSI_PIN  6
    
    #define HAL_LCD_MISO_PORT 1
    #define HAL_LCD_MISO_PIN  7
    */
    
    /* 88 SPI lines */
    #define HAL_88_CLK_PORT 0
    #define HAL_88_CLK_PIN  5
    
    #define HAL_88_MOSI_PORT 0
    #define HAL_88_MOSI_PIN  3
    
    #define HAL_88_MISO_PORT 0
    #define HAL_88_MISO_PIN  2
    
    
    
    /* SPI settings */
    #define HAL_SPI_CLOCK_POL_LO       0x00
    #define HAL_SPI_CLOCK_PHA_0        0x00
    #define HAL_SPI_TRANSFER_MSB_FIRST 0x20
    
    /* LCD lines */
    //#define LCD_MAX_LINE_COUNT              3
    #define A88_MAX_LINE_COUNT                 3
    /* Defines for HW LCD */
    
    
    /**************************************************************************************************
     *                                           MACROS
     **************************************************************************************************/
    
    #define HAL_IO_SET(port, pin, val)        HAL_IO_SET_PREP(port, pin, val)
    #define HAL_IO_SET_PREP(port, pin, val)   st( P##port##_##pin## = val; )
    
    #define HAL_CONFIG_IO_OUTPUT(port, pin, val)      HAL_CONFIG_IO_OUTPUT_PREP(port, pin, val)
    #define HAL_CONFIG_IO_OUTPUT_PREP(port, pin, val) st( P##port##SEL &= ~BV(pin); \
                                                          P##port##_##pin## = val; \
                                                          P##port##DIR |= BV(pin); )
    
    #define HAL_CONFIG_IO_PERIPHERAL(port, pin)      HAL_CONFIG_IO_PERIPHERAL_PREP(port, pin)
    #define HAL_CONFIG_IO_PERIPHERAL_PREP(port, pin) st( P##port##SEL |= BV(pin); )
    
    
    /* SPI interface control */
    #define A88_SPI_BEGIN()     HAL_IO_SET(HAL_88_CS_PORT,  HAL_88_CS_PIN,  0); /* chip select */
    #define A88_SPI_END()                                                         \
    {                                                                             \
      asm("NOP");                                                                 \
      asm("NOP");                                                                 \
      asm("NOP");                                                                 \
      asm("NOP");                                                                 \
      HAL_IO_SET(HAL_88_CS_PORT,  HAL_88_CS_PIN,  1); /* chip select */         \
    }
    /* clear the received and transmit byte status, write tx data to buffer, wait till transmit done */
    #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))); }
    //saurabh added below block for SPI read from slave
    #define A88_SPI_RX()                    U0DBUF;
    //#define A88_SPI_WAIT_RXRDY()            { while(!(U0CSR & BV(1))); }
    
    // Control macros 
    #define A88_ACTIVATE_RESET()  HAL_IO_SET(HAL_88_RESET_PORT, HAL_88_RESET_PIN, 0);
    #define A88_RELEASE_RESET()   HAL_IO_SET(HAL_88_RESET_PORT, HAL_88_RESET_PIN, 1);
    
    #if (HAL_88 == TRUE)
    /**************************************************************************************************
     *                                       LOCAL VARIABLES
     **************************************************************************************************/
    
    static uint8 *A88_Line1;
    
    /**************************************************************************************************
     *                                       FUNCTIONS - API
     **************************************************************************************************/
    
    void Hal88_HW_Init(void);
    void Hal88_HW_WaitUs(uint16 i);
    void Hal88_HW_Clear(void);
    void Hal88_HW_ClearAllSpecChars(void);
    void Hal88_HW_Control(uint8 cmd);
    void Hal88_HW_Write(uint8 data);
    void Hal88_HW_SetContrast(uint8 value);
    void Hal88_HW_WriteChar(uint8 line, uint8 col, char text);
    void Hal88_HW_WriteLine(uint8 line, const char *pText);
    uint8 Hal88_HW_Read(void);//saurabh for spi dataread
    #endif 
    
    /**************************************************************************************************
     * @fn      Hal88Init
     *
     * @brief   Initilize LCD Service
     *
     * @param   init - pointer to void that contains the initialized value
     *
     * @return  None
     **************************************************************************************************/
    void Hal88Init(void)
    {
    #if (HAL_88 == TRUE)
      A88_Line1 = NULL;
      Hal88_HW_Init();
    #endif
    }
    
    /*************************************************************************************************
     *                    LCD EMULATION FUNCTIONS
     *
     * Some evaluation boards are equipped with Liquid Crystal Displays
     * (LCD) which may be used to display diagnostic information. These
     * functions provide LCD emulation, sending the diagnostic strings
     * to Z-Tool via the RS232 serial port. These functions are enabled
     * when the "LCD_SUPPORTED" compiler flag is placed in the makefile.
     *
     * Most applications update both lines (1 and 2) of the LCD whenever
     * text is posted to the device. This emulator assumes that line 1 is
     * updated first (saved locally) and the formatting and send operation
     * is triggered by receipt of line 2. Nothing will be transmitted if
     * only line 1 is updated.
     *
     *************************************************************************************************/
    
    
    /**************************************************************************************************
     * @fn      HalLcdWriteString
     *
     * @brief   Write a string to the LCD
     *
     * @param   str    - pointer to the string that will be displayed
     *          option - display options
     *
     * @return  None
     **************************************************************************************************/
    void Hal88WriteString ( char *str, uint8 option)
    {
    #if (HAL_88 == TRUE)
    
      uint8 strLen = 0;
      uint8 totalLen = 0;
      uint8 *buf;
      uint8 tmpLen;
    
      if ( A88_Line1 == NULL )
      {
        A88_Line1 = osal_mem_alloc( HAL_88_MAX_CHARS+1 );
        Hal88WriteString( "TexasInstruments", 1 );
      }
    
      strLen = (uint8)osal_strlen( (char*)str );
    
      /* Check boundries */
      if ( strLen > HAL_88_MAX_CHARS )
        strLen = HAL_88_MAX_CHARS;
    
      if ( option == HAL_88_LINE_1 )
      {
        /* Line 1 gets saved for later */
        osal_memcpy( A88_Line1, str, strLen );
        A88_Line1[strLen] = '\0';
      }
      else
      {
        /* Line 2 triggers action */
        tmpLen = (uint8)osal_strlen( (char*)A88_Line1 );
        totalLen =  tmpLen + 1 + strLen + 1;
        buf = osal_mem_alloc( totalLen );
        if ( buf != NULL )
        {
          /* Concatenate strings */
          osal_memcpy( buf, A88_Line1, tmpLen );
          buf[tmpLen++] = ' ';
          osal_memcpy( &buf[tmpLen], str, strLen );
          buf[tmpLen+strLen] = '\0';
    
          /* Send it out */
    #if defined (ZTOOL_P1) || defined (ZTOOL_P2)
    
    #if defined(SERIAL_DEBUG_SUPPORTED)
          debug_str( (uint8*)buf );
    #endif //LCD_SUPPORTED
    
    #endif //ZTOOL_P1
    
          /* Free mem */
          osal_mem_free( buf );
        }
      }
    
      /* Display the string */
      Hal88_HW_WriteLine (option, str);
    
    #endif //HAL_LCD
    
    }
    
    /**************************************************************************************************
     * @fn      HalLcdWriteValue
     *
     * @brief   Write a value to the LCD
     *
     * @param   value  - value that will be displayed
     *          radix  - 8, 10, 16
     *          option - display options
     *
     * @return  None
     **************************************************************************************************/
    void Hal88WriteValue ( uint32 value, const uint8 radix, uint8 option)
    {
    #if (HAL_88 == TRUE)
      uint8 buf[HAL_88_MAX_BUFF];
    
      _ltoa( value, &buf[0], radix );
      Hal88WriteString( (char*)buf, option );
    #endif
    }
    
    /**************************************************************************************************
     * @fn      HalLcdWriteScreen
     *
     * @brief   Write a value to the LCD
     *
     * @param   line1  - string that will be displayed on line 1
     *          line2  - string that will be displayed on line 2
     *
     * @return  None
     **************************************************************************************************/
    void Hal88WriteScreen( char *line1, char *line2 )
    {
    #if (HAL_88 == TRUE)
      Hal88WriteString( line1, 1 );
      Hal88WriteString( line2, 2 );
    #endif
    }
    
    /**************************************************************************************************
     * @fn      HalLcdWriteStringValue
     *
     * @brief   Write a string followed by a value to the LCD
     *
     * @param   title  - Title that will be displayed before the value
     *          value  - value
     *          format - redix
     *          line   - line number
     *
     * @return  None
     **************************************************************************************************/
    void Hal88WriteStringValue( char *title, uint16 value, uint8 format, uint8 line )
    {
    #if (HAL_88 == TRUE)
      uint8 tmpLen;
      uint8 buf[HAL_88_MAX_BUFF];
      uint32 err;
    
      tmpLen = (uint8)osal_strlen( (char*)title );
      osal_memcpy( buf, title, tmpLen );
      buf[tmpLen] = ' ';
      err = (uint32)(value);
      _ltoa( err, &buf[tmpLen+1], format );
      Hal88WriteString( (char*)buf, line );		
    #endif
    }
    
    /**************************************************************************************************
     * @fn      HalLcdWriteStringValue
     *
     * @brief   Write a string followed by a value to the LCD
     *
     * @param   title   - Title that will be displayed before the value
     *          value1  - value #1
     *          format1 - redix of value #1
     *          value2  - value #2
     *          format2 - redix of value #2
     *          line    - line number
     *
     * @return  None
     **************************************************************************************************/
    void Hal88WriteStringValueValue( char *title, uint16 value1, uint8 format1,
                                      uint16 value2, uint8 format2, uint8 line )
    {
    
    #if (HAL_88 == TRUE)
    
      uint8 tmpLen;
      uint8 buf[HAL_88_MAX_BUFF];
      uint32 err;
    
      tmpLen = (uint8)osal_strlen( (char*)title );
      if ( tmpLen )
      {
        osal_memcpy( buf, title, tmpLen );
        buf[tmpLen++] = ' ';
      }
    
      err = (uint32)(value1);
      _ltoa( err, &buf[tmpLen], format1 );
      tmpLen = (uint8)osal_strlen( (char*)buf );
    
      buf[tmpLen++] = ',';
      buf[tmpLen++] = ' ';
      err = (uint32)(value2);
      _ltoa( err, &buf[tmpLen], format2 );
    
      Hal88WriteString( (char *)buf, line );		
    
    #endif
    }
    
    /**************************************************************************************************
     * @fn      HalLcdDisplayPercentBar
     *
     * @brief   Display percentage bar on the LCD
     *
     * @param   title   -
     *          value   -
     *
     * @return  None
     **************************************************************************************************/
    void Hal88DisplayPercentBar( char *title, uint8 value )
    {
    #if (HAL_88 == TRUE)
    
      uint8 percent;
      uint8 leftOver;
      uint8 buf[17];
      uint32 err;
      uint8 x;
    
      /* Write the title: */
      Hal88WriteString( title, HAL_88_LINE_1 );
    
      if ( value > 100 )
        value = 100;
    
      /* convert to blocks */
      percent = (uint8)(value / 10);
      leftOver = (uint8)(value % 10);
    
      /* Make window */
      osal_memcpy( buf, "[          ]  ", 15 );
    
      for ( x = 0; x < percent; x ++ )
      {
        buf[1+x] = '>';
      }
    
      if ( leftOver >= 5 )
        buf[1+x] = '+';
    
      err = (uint32)value;
      _ltoa( err, (uint8*)&buf[13], 10 );
    
      Hal88WriteString( (char*)buf, HAL_88_LINE_2 );
    
    #endif
    
    }
    
    #if (HAL_88 == TRUE)
    /**************************************************************************************************
     *                                    HARDWARE LCD
     **************************************************************************************************/
    
    /**************************************************************************************************
     * @fn      halLcd_ConfigIO
     *
     * @brief   Configure IO lines needed for LCD control.
     *
     * @param   None
     *
     * @return  None
     **************************************************************************************************/
    static void hal88_ConfigIO(void)
    {
      /* GPIO configuration */
      HAL_CONFIG_IO_OUTPUT(HAL_88_MODE_PORT,  HAL_88_MODE_PIN,  1);
      HAL_CONFIG_IO_OUTPUT(HAL_88_RESET_PORT, HAL_88_RESET_PIN, 1);
      HAL_CONFIG_IO_OUTPUT(HAL_88_CS_PORT,    HAL_88_CS_PIN,    1);
    }
    
    /**************************************************************************************************
     * @fn      halLcd_ConfigSPI
     *
     * @brief   Configure SPI lines needed for talking to LCD.
     *
     * @param   None
     *
     * @return  None
     **************************************************************************************************/
    static void hal88_ConfigSPI(void)
    {
      /* UART/SPI Peripheral configuration */
    
       uint8 baud_exponent;
       uint8 baud_mantissa;
    
      /* Set SPI on UART 1 alternative 2 */
      //PERCFG |= 0x02;
    
       PERCFG |=0x02;// Set SPI on UART0 alternative 0
      /* Configure clk, master out and master in lines */
      HAL_CONFIG_IO_PERIPHERAL(HAL_88_CLK_PORT,  HAL_88_CLK_PIN);
      HAL_CONFIG_IO_PERIPHERAL(HAL_88_MOSI_PORT, HAL_88_MOSI_PIN);
      HAL_CONFIG_IO_PERIPHERAL(HAL_88_MISO_PORT, HAL_88_MISO_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 = 15;
      baud_mantissa =  0;
    
      /* Configure SPI 
      U1UCR  = 0x80;      /* Flush and goto IDLE state. 8-N-1. 
      U1CSR  = 0x00;      /* SPI mode, master. 
      U1GCR  = HAL_SPI_TRANSFER_MSB_FIRST | HAL_SPI_CLOCK_PHA_0 | HAL_SPI_CLOCK_POL_LO | baud_exponent;
      U1BAUD = baud_mantissa;*/
      
      /* Configure SPI */
      U0UCR  = 0x80;      /* Flush and goto IDLE state. 8-N-1. */
      U0CSR  = 0x00;      /* SPI mode, master. */
      U0GCR  = HAL_SPI_TRANSFER_MSB_FIRST | HAL_SPI_CLOCK_PHA_0 | HAL_SPI_CLOCK_POL_LO | baud_exponent;
      U0BAUD = baud_mantissa;
      
    }
    
    /**************************************************************************************************
     * @fn      HalLcd_HW_Init
     *
     * @brief   Initilize HW LCD Driver.
     *
     * @param   None
     *
     * @return  None
     **************************************************************************************************/
    void Hal88_HW_Init(void)
    {
      /* Initialize LCD IO lines */
      hal88_ConfigIO();
    
      /* Initialize SPI */
      hal88_ConfigSPI(); //Anup
    
      /* Perform reset */
     A88_ACTIVATE_RESET();
      Hal88_HW_WaitUs(15000); // 15 ms
     A88_RELEASE_RESET();
      Hal88_HW_WaitUs(15); // 15 us
    
      /* Perform the initialization sequence */
      //FUNCTION_SET(CGRAM | COM_FORWARD | THREE_LINE);
    
      /* Set contrast */
      //HalLcd_HW_SetContrast(15);
    
      /* Set power */
      //SET_POWER_SAVE_MODE(OSC_OFF | POWER_SAVE_ON);
      //SET_POWER_CTRL(VOLTAGE_DIVIDER_ON | CONVERTER_AND_REG_ON);
      //SET_BIAS_CTRL(BIAS_1_5);
      Hal88_HW_WaitUs(21000);// 21 ms
    
      /* Clear the display */
      Hal88_HW_Clear();
      Hal88_HW_ClearAllSpecChars();
      //Hal88WriteString( "ad", HAL_88_LINE_1 ); //for test only
      uint8 rxBufferMaster[10]='/0';
      for (uint8 i=0;i<10;i++)
      {
      Hal88_HW_Write('a'+i);//for test only spi saurabh 24 sep 2018
      rxBufferMaster[i]=Hal88_HW_Read();
    //  U1DBUF = 'b';
    //  while (!U0TX_BYTE);
    //  rxBufferMaster[i] = U0DBUF;
    //  U0TX_BYTE = 0;
      //SET_DISPLAY_CTRL(DISPLAY_CTRL_ON | DISPLAY_CTRL_BLINK_OFF | DISPLAY_CTRL_CURSOR_OFF);
    }
    }
    
    
    /**************************************************************************************************
     * @fn      HalLcd_HW_Control
     *
     * @brief   Write 1 command to the LCD
     *
     * @param   uint8 cmd - command to be written to the LCD
     *
     * @return  None
     **************************************************************************************************/
    void Hal88_HW_Control(uint8 cmd)
    {
     A88_SPI_BEGIN();
     //A88_DO_CONTROL();
     A88_SPI_TX(cmd);
     A88_SPI_WAIT_RXRDY();
     A88_SPI_END();
    }
    
    /**************************************************************************************************
     * @fn      HalLcd_HW_Write
     *
     * @brief   Write 1 byte to the LCD
     *
     * @param   uint8 data - data to be written to the LCD
     *
     * @return  None
     **************************************************************************************************/
    void Hal88_HW_Write(uint8 data)
    {
     A88_SPI_BEGIN();
     //A88_DO_WRITE();
     A88_SPI_TX(data);
     A88_SPI_WAIT_RXRDY();
     A88_SPI_END();
    }
    
    uint8 Hal88_HW_Read()
    {
      A88_SPI_BEGIN();
      uint8 readfromSPI=A88_SPI_RX();
      A88_SPI_WAIT_RXRDY();
      A88_SPI_END();
      
    }
    /**************************************************************************************************
     * @fn          HalLcd_HW_SetContrast
     *
     * @brief       Set display contrast
     *
     * @param       uint8 value - contrast value
     *
     * @return      none
     **************************************************************************************************/
    /*void HalLcd_HW_SetContrast(uint8 value)
    {
      SET_ICONRAM_ADDR(CONTRAST_CTRL_REGISTER);
      HalLcd_HW_Write(value);
    }
    */
    
    /**************************************************************************************************
     * @fn      HalLcd_HW_Clear
     *
     * @brief   Clear the HW LCD
     *
     * @param   None
     *
     * @return  None
     **************************************************************************************************/
    void Hal88_HW_Clear(void)
    {
      uint8 n;
    
      //SET_DDRAM_ADDR(0x00);
      for (n = 0; n < (A88_MAX_LINE_COUNT * HAL_88_MAX_CHARS); n++)
      {
        Hal88_HW_Write(' ');
      }
    }
    
    /**************************************************************************************************
     * @fn      HalLcd_HW_ClearAllSpecChars
     *
     * @brief   Clear all special chars
     *
     * @param   None
     *
     * @return  None
     **************************************************************************************************/
    void Hal88_HW_ClearAllSpecChars(void)
    {
      uint8 n = 0;
    
      //SET_GCRAM_CHAR(0);
      for (n = 0; n < (8 * 8); n++)
      {
        Hal88_HW_Write(0x00);
      }
    }
    
    /**************************************************************************************************
     * @fn      HalLcd_HW_WriteChar
     *
     * @brief   Write one char to the display
     *
     * @param   uint8 line - line number that the char will be displayed
     *          uint8 col - colum where the char will be displayed
     *
     * @return  None
     **************************************************************************************************/
    void Hal88_HW_WriteChar(uint8 line, uint8 col, char text)
    {
      if (col < HAL_88_MAX_CHARS)
      {
        //SET_DDRAM_ADDR((line - 1) * HAL_88_MAX_CHARS + col);
        Hal88_HW_Write(text);
      }
      else
      {
        return;
      }
    }
    
    /**************************************************************************************************
     * @fn          halLcdWriteLine
     *
     * @brief       Write one line on display
     *
     * @param       uint8 line - display line
     *              char *pText - text buffer to write
     *
     * @return      none
     **************************************************************************************************/
    void Hal88_HW_WriteLine(uint8 line, const char *pText)
    {
      uint8 count;
      uint8 totalLength = (uint8)osal_strlen( (char *)pText );
    
      /* Write the content first */
      for (count=0; count<totalLength; count++)
      {
        Hal88_HW_WriteChar(line, count, (*(pText++)));
      }
    
      /* Write blank spaces to rest of the line */
      for(count=totalLength; count<HAL_88_MAX_CHARS;count++)
      {
        Hal88_HW_WriteChar(line, count, ' ');
      }
    }
    
    /**************************************************************************************************
     * @fn      HalLcd_HW_WaitUs
     *
     * @brief   wait for x us. @ 32MHz MCU clock it takes 32 "nop"s for 1 us delay.
     *
     * @param   x us. range[0-65536]
     *
     * @return  None
     **************************************************************************************************/
    void Hal88_HW_WaitUs(uint16 microSecs)
    {
      while(microSecs--)
      {
        /* 32 NOPs == 1 usecs */
        asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop");
        asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop");
        asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop");
        asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop");
        asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop");
        asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop");
        asm("nop"); asm("nop");
      }
    }
    #endif
    
    
    /**************************************************************************************************
    **************************************************************************************************/
    
    
    
    

    and am using Uart 0 in alt 2 pin map. I can see transmitted data in transmit buffer and arduino uno receives this spi data correctly , as i can see it push the data on serial output of arduino that i monitor on serial monitor of hercules/arduino IDE

    Now i am getting trouble in reading the data coming from SPI slave and read it from U0DBUF, basically thr implementation of SPI READ function that sets some bit fields is whats the missing piece.