µTasker Forum > µTasker general

User Documentation Source Code

<< < (3/3)

internship2:
Hi Mark
I still geth in a lot of trouble doing the debug msg. I have try to debug, and my code newer get in to the seriel configuration wich i have make the configuration in app_hw_kinetis.h:
#ifdef SERIAL_INTERFACE
    #define WELCOME_MESSAGE_UART   "\r\n\nHello, world... KINETIS\r\n"
    #define NUMBER_EXTERNAL_SERIAL 0
    #define NUMBER_SERIAL   (UARTS_AVAILABLE)                            // the number of physical queues needed for serial interface(s)
    #define SIM_COM_EXTENDED                                             // COM ports defined from 1..255
    #define SERIAL_PORT_0    3                                           // if we open UART channel 0 we simulate using comx on the PC
  //  #define SERIAL_PORT_1    9                                           // if we open UART channel 1 we simulate using comx on the PC
   // #define SERIAL_PORT_2    9                                           // if we open UART channel 2 we simulate using comx on the PC
   // #define SERIAL_PORT_3    9                                           // if we open UART channel 3 we simulate using comx on the PC
   // #define SERIAL_PORT_4    13                                          // if we open UART channel 4 we simulate using comx on the PC
   // #define SERIAL_PORT_5    9                                           // if we open UART channel 5 we simulate using comx on the PC
#if defined TWR_K70F120M
        #define DEMO_UART    2                                           // use UART 2
    #elif defined TWR_K20N50M                                            // {2}
        #define DEMO_UART    1                                           // use UART 1
    #elif defined KWIKSTIK || defined TWR_K60F120M
        #define DEMO_UART    5                                           // use UART 5
    #else
        #define DEMO_UART    3                                           // use UART 3
    #endif

in config.h:

#define SERIAL_INTERFACE                                                 // enable serial interface driver
#ifdef SERIAL_INTERFACE
    #define SERIAL_STATS                                                 // keep statistics about serial interface use
    #define SUPPORT_MSG_MODE                                             // enable terminator recognition (MSG_MODE)
    #define SUPPORT_MSG_CNT                                              // enable the message counter mode (MSG_MODE_RX_CNT) - requires also SUPPORT_MSG_MODE
    #define WAKE_BLOCKED_TX                                              // allow a blocked transmitter to continue after an interrupt event
      //#define WAKE_BLOCKED_TX_BUFFER_LEVEL                             

I don't get it ! you now what i am doing wrong, i tryet to follow the link you send

mark:
Hi

Assuming that you are using the TWR_K70F120M, this has its debug output on UART 2.

If you want UART2 to be mapped to COM3 on the PC you need

#define SERIAL_PORT_2    3

You can set other SERIAL_PORT_X values to 0 so that they are disabled.

Regards

Mark

Geoff:
Sorry Mark to dredge up an old thread, but I'm trying to get the demo UART working in simulation.  Should your instruction above about mapping UART2 not actually be referring to SERIAL_PORT_2 rather than SERIAL_PORT_3

ie, is this correct for mapping UART2 to COM3 on the PC ?

--- Code: ---#define SERIAL_PORT_2    3
--- End code ---

and a related question about the DEMO_UART - is the number referring to the UART channel on the device, and hence is the correct way to define use of UART channel 0 (ie UART0) as follows

--- Code: ---#define DEMO_UART 0
--- End code ---

mark:
Geoff

Yes, there was a type (I edited it now).

To select the UART used as command line interface and general debug message output you select it with DEMO_UART.
This counts the same as the UARTs on the Kinetis.
#define DEMO_UART 0 is thus for UART0.

To connect UART0 to a COM port on the PC you can then use (assuming COM9)
#define SERIAL_PORT_0    9

If you want a virtual loop back (to a terminal emulator) you can use com0com to install some loop-backs. If you configure a loop-back between COM 9 and COM 10 you can open the terminal emulator on COM 10 (before you start the simulator) and then let the simulator run (check the status bar when it runs where it shows with UARTs have been opened and which virtual COM port connections that are using to be sure).

After changing the #define SERIAL_PORT_0  setting do a rebuild since otherwise VS doesn't always build the C++ file using the define and so it doesn't take. With the rebuild it is always good afterwards.

Regards

Mark

Navigation

[0] Message Index

[*] Previous page

Go to full version