The problem of  the uart program run on frdmk64f in kds

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

The problem of  the uart program run on frdmk64f in kds

2,472件の閲覧回数
wyflsxy
Contributor II

hello,there is something wrong of my uart program

when I run the example of "uart_poling_example_frdmk64f",it work ok

but when I copy the code of the example to my project and compiled

when it run ,there is no any output on serial port

do you  know what wrong with it?

ラベル(1)
0 件の賞賛
返信
14 返答(返信)

1,819件の閲覧回数
ivadorazinova
NXP Employee
NXP Employee

Hello wang yufei,

better and safety procedure is start with the example and add your code here.

There could be problems with paths/linker. Maybe you forgot interrupt handler in your code.

Please, can you attach your project?

Best Regards,

Iva

0 件の賞賛
返信

1,819件の閲覧回数
wyflsxy
Contributor II

I used kds3.0 of KSDK1.2 and MQX4.2,my board is frdmk64f

I refer to document the method on the create and copy the KSDK engineering examples respectively, but the compilation always has a problem, the code is copy in the example code, please see the problem is where to set up, thank you

0 件の賞賛
返信

1,819件の閲覧回数
Carlos_Musich
NXP Employee
NXP Employee

Hi,

if you are using KDS3.0 and MQX for KSDK1.2 you may find the example in link below useful.

Re: poll stdin

Note that I commented out line 283 in init_bsp.c. I did this to avoid MQX initializing UART0 and to be able to use the KSDK driver.

Regards,

Carlos

0 件の賞賛
返信

1,819件の閲覧回数
wyflsxy
Contributor II

additional

I found that when I follow your demo to commented out line the code "_bsp_nio_stdio_install();" in init_bsp.c

the code of TCPIP communication  which I debuged ok before should not be used???

0 件の賞賛
返信

1,819件の閲覧回数
Carlos_Musich
NXP Employee
NXP Employee

Hi Wang,

In fact there are some errors in that example I will update it.

- If you can see in table "Interrupt vector assignments" on Reference Manual it shows vector number and Interrupt number, but I still dont know why I put 45.

- It is also necessary to change the IRQ handler name when using MQX because the IRQ handler are set in bsp at startup and it should not be overwritten.

- The problem with disabling MQX console initialization is that you will not have stdio support. In this case you may keep UART0 to be the MQX standard output and configure another UART for other purpose.

The latest version of UART example is here.

Regards,

Carlos

0 件の賞賛
返信

1,819件の閲覧回数
wyflsxy
Contributor II

Hi Carlos_Musich​ ,

I still have some question

- The problem with disabling MQX console initialization is that you will not have stdio support. In this case you may keep UART0 to be the MQX standard output and configure another UART for other purpose.

1  can I change MQX standard output  form UART0 to UART1 or other uart? how ?

2  with the demo which you provide, I found the uart interrupt will trigger when it send every 8 bytes or receives every 1 bytes,

how can I set it Only trigger by receives data not trigger by send data??

3  did it need to clear any flag when it's run into a uart interrupt?

4  how can I use a serial port interrupt  to achieve that  to receiving a  length of the unknown long  array of bytes at a time? Rather than in your demo of an one byte received once? Use the callback function? Can you give me a demo for it?

0 件の賞賛
返信

1,819件の閲覧回数
Carlos_Musich
NXP Employee
NXP Employee

Hi Wang,

1) In init_bsp.c dbg_uart_init() is called, it uses  DbgConsole_Init() and you can change the UART instance here.

2) Unfortunately it is not possible as there are no separate interrupts. You must check flasgs in status register to detirmine which event triggered interrupt.

3) The KSDK drivers does this when you add the irq.c file into your application such as I did.

4) I can work in a demo but it will take some time because there are many other projects with higher priority.

Regards,

Carlos

0 件の賞賛
返信

1,819件の閲覧回数
wyflsxy
Contributor II

hi Carlos_Musich​,

1) In init_bsp.c dbg_uart_init() is called, it uses  DbgConsole_Init() and you can change the UART instance here

I found dbg_uart_init() in init_bsp.c,but it seems that it will not to be called by the default,

and even it was called ,it's only init the uart

#if !BSPCFG_ENABLE_IO_SUBSYSTEM

    dbg_uart_init(); //wangyufei

#endif

when i init uart,I can use the "UART_DRV_SendData(BOARD_DEBUG_UART_INSTANCE, bufferData1, byteCountBuff);"

to choose whice uart port I want to send

but how can I change the output port form uart0 to uart1 used the "fprintf"??? how can I choose the uart port?i still don't know how to change MQX standard output  form UART0 to UART1 or other uart...

0 件の賞賛
返信

1,819件の閲覧回数
Carlos_Musich
NXP Employee
NXP Employee

Hi Wang,

In board.h you can change next macros.

#define BOARD_DEBUG_UART_INSTANCE   0

#define BOARD_DEBUG_UART_BASEADDR   UART0

Regards,

Carlos

0 件の賞賛
返信

1,819件の閲覧回数
wyflsxy
Contributor II

thank you

0 件の賞賛
返信

1,819件の閲覧回数
wyflsxy
Contributor II

hi,Carlos_Musich

thank you for your answer,it's help me a lot

But I still have some questions to ask you about a serial port interrupt

1  In the demo you write ,I saw you installed interrupt by " OSA_InstallIntHandler(45, &UART0_RX_TX_IRQHandler);"

but I don't anderstand why it's "45" for the first parameter,for uart0 interrupt ,it should be UART0_RX_TX_IRQn as 31

isn't it?

and when I commented out,I'm surprised that the The program was still run into the The interrupt function "UART0_RX_TX_IRQHandler",did you know why ?

in MK64F12.h
UART0_RX_TX_IRQn            = 31,              /**< UART0 Receive/Transmit interrupt */

  UART0_ERR_IRQn              = 32,              /**< UART0 Error interrupt */

  UART1_RX_TX_IRQn            = 33,              /**< UART1 Receive/Transmit interrupt */

  UART1_ERR_IRQn              = 34,              /**< UART1 Error interrupt */

  UART2_RX_TX_IRQn            = 35,              /**< UART2 Receive/Transmit interrupt */

  UART2_ERR_IRQn              = 36,              /**< UART2 Error interrupt */

  UART3_RX_TX_IRQn            = 37,              /**< UART3 Receive/Transmit interrupt */

  UART3_ERR_IRQn              = 38,              /**< UART3 Error interrupt */

  ADC0_IRQn                    = 39,              /**< ADC0 interrupt */

  CMP0_IRQn                    = 40,              /**< CMP0 interrupt */

  CMP1_IRQn                    = 41,              /**< CMP1 interrupt */

  FTM0_IRQn                    = 42,              /**< FTM0 fault, overflow and channels interrupt */

  FTM1_IRQn                    = 43,              /**< FTM1 fault, overflow and channels interrupt */

  FTM2_IRQn                    = 44,              /**< FTM2 fault, overflow and channels interrupt */

  CMT_IRQn                    = 45,              /**< CMT interrupt */

  RTC_IRQn                    = 46,              /**< RTC interrupt */

2  I found that The program run into The interrupt function  "UART0_RX_TX_IRQHandler" when the serial port was writed or read,

I want to know How to set up it only when a serial port receives data into the interrupt program

3 I found it write every 8 bytes will trigger an interrupt and receives every 1 bytes will trigger an interrupt

how can I set it Only trigger by receives data not trigger by send data??

and can I set it Accept the whole data to raise the interrupt?

so that I can receive the full packet  and then deal with

0 件の賞賛
返信

1,818件の閲覧回数
mayurkhandagale
Contributor I

Hi Sir My name mayur. I am doing a project in KDS. My Project is to receice Data on UART using Interrupt. I want to write my Own IRQ handler for UART3 . I am doing My IRQ function Below is the code that i wrote please guide me, This function is located in fsl_uart_irq.c file

void UART3_RX_TX_IRQHandler(void)

       {

    if(UART3_RX_TX_IRQn==1)

        GPIO_DRV_ClearPinIntFlag(0); // Clear IRQ flag

        UART_C2_RIE_MASK;

        Rx_buff[RxCnt++]=0;

//UART3_RX_TX_IRQn=0;

    PORTC_ISFR = PORT_ISFR_ISF(0x40);

       }

0 件の賞賛
返信

1,818件の閲覧回数
wyflsxy
Contributor II

bmwhui

0 件の賞賛
返信

1,818件の閲覧回数
wyflsxy
Contributor II

I copied the eth_to_serial_frdmk64f files in my new project, compiling, download the program, but the program is run later still no data output, serial code of Ethernet and are unable to get the correct results after operation, but the demo running leds is allowed,

could you tell me how did this problem?

Confirm the choice of the new engineering is frdmkK64, BSP need not modify is no problem???????

Urgent help!!!!!!!!!!!

0 件の賞賛
返信