What is the proper UART assignment for using printf with JTAG?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What is the proper UART assignment for using printf with JTAG?

Jump to solution
1,913 Views
dave408
Senior Contributor II

I'm just getting started with KDS 3.0 and KSDK 1.2 and am in the process of recreating the work I've previously done with KDS 2.0 and KSDK 1.1.

 

I would like to be able to use debug_printf with the DbgCs1 component on a custom MK64FN1M0VLL12-based PCB.  I also want to communicate with other peripherals over RS485 or RS232.  I believe I have a problem with the routing, because the RS485 connection is routed to PTB16/PTB17, which is allocated to UART0.  Since JTAG is also connected to UART0, then I assume this means I'm going to have to re-route the signals, or just not use that port until the next rev.

 

So in short, I take it that the proper design methodology behind incorporating Kinetis processors is to first look at the UART that shares pins with the JTAG connections, and then prevent usage of this UART on any of the other pins that provide access to that peripheral?

 

In addition, when I select those pins in DbgCs1, I get a conflict with my CPU settings:

 

29043_29043.pngpastedImage_0.png

29044_29044.pngpastedImage_1.png

 

What is the right approach for supporting debug_printf over JTAG and JTAG if I'm getting conflicts in the PEx definitions?

Labels (1)
1 Solution
1,068 Views
ivadorazinova
NXP Employee
NXP Employee

Hello Alice,

You should choose the UART which you want to use and re-route to specific pins.

If you don´t want to use UART, you can disable pins for UART0 and set Baud rate.

alice.png

fsl_dbg_console is always needed (it is required from OSA layer).

I hope this helps,

Best Regards,

Iva

View solution in original post

0 Kudos
10 Replies
1,068 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Dave,

Please tell us the KDS version , and whether with KSDK ?

And the debug interface part , which component do you use , please screenshot , thank !

BR

Alice

0 Kudos
1,068 Views
dave408
Senior Contributor II

Hi Alice, I'm using KDS 3.0 and KSDK 1.2.  Here are some extra screenshots, as I'm not sure which you're really looking for.

pastedImage_0.png

To get around my problem, I have temporarily set DbgCs1 to use UART3:

pastedImage_1.png

What I'm not understanding is that I thought that debug_printf could be redirected over the JTAG connection and show up in the console window in KDS.  I don't know how to make this work, but it seems that DbgCs1 is not the component that allows this.  Am I correct that DbgCs1 must be assigned a physical UART because it can really only output to a terminal program?  But if this is the case, why would MQX require DgbCs1 when it can somehow output to the KDS console (via semihosting?).  Shouldn't there be a way to disable DbgCs1 if we don't need it and actually want to use UART0 for other things?

0 Kudos
1,068 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Dave,

From your describe, i can answer you two questions , if i lost something or misunderstand you , please tell me .

(1)  print to console window  : in this situation, we need not the component of "fsl_debug_sonsole" , simple create a project , then configure it as this :

you will see the character you want to print on the console window . (you also can refer to here : Semihosting with GNU ARM Embedded (Launchpad) and Kinetis Design Studio | MCU on Eclipse  )

(2)About this "Shouldn't there be a way to disable DbgCs1 if we don't need it and actually want to use UART0 for other things?" ,  does you meaning , only use UART ?

if yes , you can use the component of "fsl_uart" .

Hope it helps

Alice

1,068 Views
dave408
Senior Contributor II

Alice, this worked out well, thank you.  I still would like to know about removing DbgCs1 since all printfs can now go through semihosting.

For other users that want to do this, I had to make a small change to my linker flags.  In addition to adding -specs=rdimon.specs, I had to remove -specs=nosys.specs.

In the process of debugging another project that I am currently porting, a related issue came up so I'd just like to summarize the questions I have about DbgCs1, UARTs, and fsl_debug_console:

  1. In an MQX Lite configuration, can I remove DbgCs1 completely without causing PEx to give me errors when I generate code?  It seems to really want a debug console interface.  Currently, I just assign DbgCs1 to UART3 and will avoid usage of this peripheral in my code.
  2. In an MQX Standard configuration, I *must* disable DbgCs1 per a previous conversion I had with you in another post, but I still have to associate mqx_ksdk with a "debug console" component.  Currently, I assign it the only selection from the droplist (KSDK 1.2.0/fsl_uart), and then configure this component to also use UART3 as above.
  3. Why does there seem to be a requirement to assign a debug console to a physical peripheral if I am using semihosting for printf?  Is the debug console used for anything else by the KSDK?

pastedImage_0.png

0 Kudos
1,068 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Dave,

About the MQX project on KSDK,  it same to be that the mqx_ksdk component must be conclude the "fsl_debug_console" component.

While i do not know why , i have test on many chip.  I think it just a way of design.

And printf using semihosting is not need physical peripheral . As Erich menntiond" using semihosting only needs an active debugger connection, and not a physical UART."

And i do not know why you printf to semihosting ? It is will generate big size code , please see here :

Why I don’t like printf() | MCU on Eclipse

BR

Alice

0 Kudos
1,068 Views
dave408
Senior Contributor II

Alice, I think you might have misunderstood what I was asking.  My question is, since semihosting does not need a physical UART, then why when I enable semihosting does PEx still require that I configure fsl_debug_console?  It should be optional.

I have read Erich's post about printf being evil, but for now I figure I can just use it for easier debugging, and then when I don't need it, I can disable it.  However, if I end up not needing one of the UARTs, I can disable semihosting and then re-enable fsl_debug_console.  I will have to try checking the size of my application with an without semihosting.

I guess another way of asking this question is, if I am going to use MQX and it wants fsl_debug_console assigned, then do all Kinetis designs require that one UART be reserved expressly for that component?  It would be good to know so that during design of the PCB, I can specify that a particulr UART gets reserved.

0 Kudos
1,068 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Dave ,

Yes , i know your meaning .

When we create project without  MQX , if we want use "semihosting" , it doesn't need add the "fsl_debug_console" component , it mean it  do not need physics UART.

While , i also do not know why in the MQX project ,when create project ,it can not delete the "fsl_debug_console" component , this need someone else help to explain it.

Hi

could help us ? When create SDK1.2  project on kds3.0 , configure the OS to MQX_KSDK, why the "fsl_debug_console" can not be cancelled ?If we do not

want to use UART to print .

pastedImage_0.png

Thank !

Alice

1,069 Views
ivadorazinova
NXP Employee
NXP Employee

Hello Alice,

You should choose the UART which you want to use and re-route to specific pins.

If you don´t want to use UART, you can disable pins for UART0 and set Baud rate.

alice.png

fsl_dbg_console is always needed (it is required from OSA layer).

I hope this helps,

Best Regards,

Iva

0 Kudos
1,068 Views
dave408
Senior Contributor II

Thanks for the clarification, Iva!  I'm glad to know it's okay to just assign a UART and disable the pins.  I had tried this before but wasn't sure if it was advisable or not.

1,068 Views
dave408
Senior Contributor II

Hi Alice, thanks for your info about debugging to the console window.  I will give that a try.

Regarding your #2 above, my question is based on the observation that if I disable the DbgCs1 component, I then end up with an error in the osa1 component because it's expecting to have fsl_debug_console defined:

pastedImage_0.png

I'll give the semihosting info a try now to see how it works.

0 Kudos