Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN
Hi,
I'm verifying my design with TMS570LS12x LaunchPad. I try to use CLK and NCS3 of MibSpi3 as input pins of GIO to control USER LED B in the launchpad. The location of pins is shown below. CLK is pin 7 in J2. NCS3 is pin 9 in J5. Pin 2 in J3 and pin 1 in J5 used as GND for input.
The surprising thing is NCS3 can control flashing and freezing of USER LED B ( flashing of USER LED A is just a reference without control ) by connecting and disconnecting with GND, no matter CLK connecting to GND or not. And CLK can not control at all, no matter CS3 connecting to GND or not.
What I expect is like the table below.
| CLK | NCS3 | |
| USER LED B freezing | GND | GND |
| USER LED B flashing | not GND | not care |
| USER LED B flashing | not care | not GND |
| USER LED B flashing | not GND | not GND |
I use HalCoGen to config the modes of NCS3 and CLK as below.
My test code likes that.
#include "sys_common.h"
/* USER CODE BEGIN (1) */
#include "gio.h"
#include "mibspi.h"
/* 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) */
#define DELAY_VALUE 1000000
/* USER CODE END */
int main(void)
{
/* USER CODE BEGIN (3) */
int i=0;
gioInit();
mibspiInit();
while(1)
{
if(1==gioGetBit(mibspiPORT3, PIN_CLK) || //pin7@J2, 0:pin2@J3 or pin1@J5, 1:pin1@J2
1==gioGetBit(mibspiPORT3, PIN_CS3)) //pin9@J5, 0:pin2@J3 or pin1@J5, 1:pin1@J2
{
gioToggleBit(gioPORTB, 2);
}
gioToggleBit(gioPORTB, 1);
for(i=0;i<DELAY_VALUE;i++);
}
/* USER CODE END */
return 0;
}
Is there something wrong or I need to do with CLK of MibSpi3 further ?
Best regards
Datïan