Other Parts Discussed in Thread: HALCOGEN,
TI Team,
I'm having a simple query regarding MibSPI communication between two launch pads (LaunchXL2-TMS570LC4357). One board is configured as a master and another board is configured as a slave. HALCoGen configuration for Master is as shown in the images below:
Slave configuration is also same but two differences:
- Master Mode chebox is unchecked
- Internal Clock checkbox is unchecked
Both the boards are connected through external headers as shown in the image below:

The HL_sys_main.c file for master and slave are as follows:
/* USER CODE BEGIN (0) */
/* USER CODE END */
/* Include Files */
#include "HL_sys_common.h"
/* USER CODE BEGIN (1) */
#include "HL_mibspi.h"
#define data_length 16
unsigned long counter1 = 0;
bool transmit_flag = 0;
/* USER CODE END */
/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/
/* USER CODE BEGIN (2) */
/* USER CODE END */
int main(void)
{
/* USER CODE BEGIN (3) */
uint16 tx_data[data_length] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
uint16 rx_data[data_length] = {0};
_enable_IRQ_interrupt_();
mibspiInit();
mibspiEnableGroupNotification(mibspiREG1, 0, 1);
// mibspiEnableLoopback(mibspiREG1, Analog_Lbk);
while(1)
{
if(transmit_flag == 0)
{
mibspiSetData(mibspiREG1, 0, &tx_data[0]);
mibspiTransfer(mibspiREG1, 0);
transmit_flag=1;
}
/* if(mibspiIsTransferComplete (mibspiREG1, 0))
{
transmit_flag=0;
}*/
}
// while(!(mibspiIsTransferComplete (mibspiREG1, 0)));
// mibspiGetData(mibspiREG1, 0, &rx_data[0]);
while(1);
/* USER CODE END */
return 0;
}
/* USER CODE BEGIN (4) */
void mibspiGroupNotification(mibspiBASE_t *mibspi, uint32 group)
{
printf("\n Transfer %d completed!!", counter1);
printf("\n");
counter1++;
transmit_flag = 0;
}
/* USER CODE END */
/* USER CODE BEGIN (0) */
/* USER CODE END */
/* Include Files */
#include "HL_sys_common.h"
/* USER CODE BEGIN (1) */
#include "HL_mibspi.h"
#define data_length 16
unsigned char rx_data[data_length] = {0};
unsigned long counter1 = 0;
bool receive_flag = 1; // this value is initialized to 1 becasue, the SPI transfer function shall only execute when the data is received.
// Hence, the moment any data is received on SPI receive buffer, Group Notification function will execute.
// This will set the flag value to 0 and then the received data will be processed.
/* USER CODE END */
/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/
/* USER CODE BEGIN (2) */
/* USER CODE END */
int main(void)
{
/* USER CODE BEGIN (3) */
_enable_IRQ_interrupt_();
mibspiInit();
mibspiEnableGroupNotification(mibspiREG1, 0, 1);
while(1)
{
// if(receive_flag == 0)
{
mibspiTransfer(mibspiREG1, 0);
// receive_flag = 1;
}
}
/* USER CODE END */
return 0;
}
/* USER CODE BEGIN (4) */
void mibspiGroupNotification(mibspiBASE_t *mibspi, uint32 group)
{
uint16 *data;
data = &rx_data[0];
mibspiGetData(mibspi, group, data);
}
/* USER CODE END */
Problem Statement:
- Master program seems to be working fine as I'm able to see the transmited data on oscilloscope and on CCS console as well/
- I'm not able to receive any data in Slave device.
I think there is some minor mistake in either HALCoGen config for Slave device or logical mistake in HL_sys_main.c file for slave. Can someone please help?
Regards,
Trivedi










