AnsweredAssumed Answered

A problem connecting the KMS to a custom hardware

Question asked by rumen pasev on Feb 5, 2018
Latest reply on Feb 5, 2018 by rumen pasev

Hello, I have a problem connecting the KMS to a custom hardware.

I'm working on a Windows 10(32 bit) machine, using the MCUXpresso v10.1.0 and KMS 1.2.0.
I do the flash programming and debugging using a SEGGER j-link debug probe.

My control board incorporates a 64-pin MKV31F128VLHP MCU.
(the device is really KMS-enabled, at least each attempt to read the highest 8 kbytes results in an error)
My serial communication interface uses UART1(PTE0, PTE1) pins instead of (default) UART0.

I created a KMS-project, selecting a PMSM motor, KV3x family, High Voltage platform, Sensorless Velocity control, MCUXpresso IDE.
Then I followed all the relevant steps depicted in AN5254 "Adapting KMS for Custom Hardware.pdf" Rev. 3, 11/2017:
- created an SDK for the MKV31F128xxx10 and added it to the IDE
- changed the MCU Part Number as described
- in "kms_hw.h" changed UART0 to UART1
- in "pin_mux.h" changed the UART-pins definitions to correspond to the actually used ones(pins 1 and 2 - PTE0, PTE1) for UART1

Then I tried to connect the KMS to the MCU board. This did not succeed.
I received the following message from KMS:
-----------------------------------------------------------------------
An issue has prevented communication with target
MCU: The ping message was not acknowledged.
Please check physical connection to MCU, then
navigate to Project menu to configure communication
port.
----------------------------------------------------------------------

Further, I looked inside "main.c" and found there some calls and function declarations/definitions, explicitly referring to UART0:
- FAST void UART0_RX_TX_IRQHandler(void) which overwrites the WEAK void UART0_RX_TX_IRQHandler(void)
- void UART0_ERR_IRQHandler(void)
- NVIC_EnableIRQ(UART0_RX_TX_IRQn);
- NVIC_SetPriority(UART0_RX_TX_IRQn, 15);
- NVIC_EnableIRQ(UART0_ERR_IRQn);
- NVIC_SetPriority(UART0_ERR_IRQn, 15);

So, I changed 'UART0' with 'UART1' in all these instances.
Now, when trying a connection with KMS, I started receiving interrupts on UART1,

but still no reply from the MCU followed.
The above message still appeared.

 

I stopped the program on a breakpoint and looked at the contents of the UART buffer "uart_rx_buf[]".
Each time a connection was tried, there were 20 bytes collected in uart_rx_buf[], looking like that:
27, 2, 36, 2, 0, 17, 2, 180, 27, 3, 27, 36, 0, 2, 0, 17, 2, 180, 27, 3.

 

The "uart_rx_head" and "uart_rx_tail" values wee both equal to 20.
However, the "uart_tx_head" and "uart_tx_tail" values stayed 0.

 

So, what I see is that the Remote Debug Agent invokes the "uart_rx_byte()" method
and fills the "uart_rx_buf[]", but "uart_tx_byte()" is never called.
I verified that by setting the optimization level to "O0" for the "rda_uart_kv3" module and adding a breakpoint inside uart_tx_byte().
The breakpoint was never hit.

 

So, as far as I can tell, all hardware-related communication problems are fixed, the RDA receives data from the KMS but it still does not answer to a ping.

Can you, please give me an advice in this situation? What shall I do to make the MCU reply?

Outcomes