AnsweredAssumed Answered

UART COMMUNICATION BETWEEN K64F AND KV31F

Question asked by Valli Sanghami Shankar Kumar on Mar 18, 2018
Latest reply on Mar 19, 2018 by Valli Sanghami Shankar Kumar

I am trying to control the PMSM motor connected to KV31F based on trigger I receive from FRDM-K64F via UART using Kinetis Motor Suite (KMS). UART0 in KV31F is being used for PMSM motor control and I'm using UART1 to establish communication between the 2 boards. After generating state flow diagram on KMS ,I have added the below code to motionsequence.c in KDS.Though there are no errors,I am unable to run the motor.

 

/* ACTIONS */

InitUserPlanVariables();

uint8_t rxInt = 0;
uint32_t byteCountBuff = 0;
uint32_t uartSourceClock = 0;
UART_Type * baseAddr = BOARD_DEBUG_UART_BASEADDR;

// Enable clock for PORTs, setup board clock source, config pin
PINS_init();

BOARD_ClockInit();

configure_uart_pins(0);

// Initialize the uart module with base address and config structure
CLOCK_SYS_EnableUartClock(BOARD_DEBUG_UART_INSTANCE);

// Get working uart clock
uartSourceClock = CLOCK_SYS_GetUartFreq(BOARD_DEBUG_UART_INSTANCE);

// Initialize UART baud rate, bit count, parity and stop bit
UART_HAL_SetBaudRate(baseAddr, uartSourceClock, BOARD_DEBUG_UART_BAUD);
UART_HAL_SetBitCountPerChar(baseAddr, kUart8BitsPerChar);
UART_HAL_SetParityMode(baseAddr, kUartParityDisabled);
#if FSL_FEATURE_UART_HAS_STOP_BIT_CONFIG_SUPPORT
UART_HAL_SetStopBitCount(baseAddr, kUartOneStopBit);
#endif

// Enable the UART transmitter and receiver
UART_HAL_EnableTransmitter(baseAddr);-
UART_HAL_EnableReceiver(baseAddr);

while(true)
{
// Wait to receive input data
if (kStatus_UART_Success == UART_HAL_ReceiveDataPolling(baseAddr, &rxInt, 1u))
//if(GPIO_DRV_ReadPinInput(PTE1)==1)
{
//input to state variable of kms

userPlanVariables.FRDMBoardInput = 1;

}
}

Outcomes