Other Parts Discussed in Thread: HALCOGEN
TI Team,
I'm facing some issue in getting my MibSPI work. I want to use 4 pin MibSPI 1 for communication i.e. MOSI, MISO, CLK, ENA. Following is the configuration:
- Master Device:
- Master Mode: Enabled
- Internal Clock: Enabled
- Wait for Enable: Enabled
- Transfer Group 0: CS_NONE, Length 16
- SOMI[1]: GPIO : Output
- SOMI[0]: SPI : Input
- SIMO[1]: GPIO : Output
- SIMO[0]: SPI : Output
- CLK : SPI : Output
- ENA : SPI : Input
- Slave Device:
- Master Mode: Disabled
- Internal Clock: Disabled
- Wait for Enable: Enabled
- Transfer Group 0: CS_NONE, Length 16
- SOMI[1]: GPIO : Output
- SOMI[0]: SPI : Output
- SIMO[1]: GPIO : Output
- SIMO[0]: SPI : Input
- CLK : SPI : Input
- ENA : SPI : Output
/* 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 */
Issue: Not able to receive data on slave device
Query: I think there is some problem with ENA pin enabling for data transmission. How shall I incorporate ENA related program to my code?
Regards,
Sameer









