K20 with UART

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

K20 with UART

2,396 Views
lander
Contributor IV

I'm pretty new at CW and microcontrollers so I keep running into issues.  I'm getting these errors that are preventing me from debugging my project...

Description Resource Path Location Type

ARM_GCC_Support/ewl/EWL_C/src/sys/uart_console_io.c undefined reference to `InitializeUART' TouchLEDs  line 200 C/C++ Problem

ARM_GCC_Support/ewl/EWL_C/src/sys/uart_console_io.c undefined reference to `ReadUARTN' TouchLEDs  line 93 C/C++ Problem

ARM_GCC_Support/ewl/EWL_C/src/sys/uart_console_io.c undefined reference to `WriteUARTN' TouchLEDs  line 151 C/C++ Problem

mingw32-make: *** [TouchLEDs.elf] Error 1 TouchLEDs    C/C++ Problem

The problem is that I can't jump to the line, declaration, or file the problem is located.  Also, when I search for 'InitializeUART', ... and the 'uart_console_io.c' on my computer, they are no where to be found.  I don't know what I'm missing to receive these errors and I don't know what to do to fix them.

Anybody know what is my issue?

Thank you,

Lander

0 Kudos
9 Replies

726 Views
adriansc
Contributor IV

Hi,

Which version of CW warrior are you using? it is the 10.3 Beta version? If you don´t know it, When did you downloaded and install CW?

There are some members who say that this problem has been solved creating the project again as a new project. You could try it! But it is not 100% accurate that this will solve your problem.

Hope this helps.

0 Kudos

726 Views
lander
Contributor IV

I have tried this with no success.  I also went to KINETIS_72MHz_SRC and created a new project with the premade .exe that basically recreates the hello_world project so the user can work on it without having to set anything up.

Do I have to make a processor expert component for UART and DMA in order to talk to the console?  And do I call any functions from the components (i.e Enable, SendChar...)?

-Lander

0 Kudos

726 Views
Frost
Contributor II

So errm... This any help?

Having the same probs.

0 Kudos

726 Views
Frost
Contributor II

I'm using a KL25 freedom board, but what I'm getting from the above is that you basically need to put in the low level functions if you've left the I/O support at UART(default) when making a new project.

For me, UART0 routes to the SDA debug MCU onboard, so it's a physical UART interface rather than console IO. Might be best to start again with "console IO" selected if you want that for printf...

So basically, I set up the UART to 38400,8,n,1, UART0 on my target, (target's pins PTA1 & PTA2) which connects to the SDA debug MCU's UART1, see the KL25 schematics if you want H/W info. Set up a terminal program in Win7 and opened the com port with matching settings, and hey presto.

Hope that helps. :smileyhappy:

0 Kudos

726 Views
JimDon
Senior Contributor III

You (or perhaps some other piece of code) are supposed to define these functions, so that things like printf will use your UART code.

This is what I did, and it make printf work:

enum {

    kUARTNoError = 0,

    kUARTUnknownBaudRate,

    kUARTConfigurationError,

    kUARTBufferOverflow,                /* specified buffer was too small */

    kUARTNoData                         /* no data available from polling */

};

//

// these are my functions:

//

uint8_t Serial_rxbyte(int port, uint8_t *data);

uint8_t Serial_txbuf(int port,uint8_t * data, uint16_t len, uint16_t *sent);

// These make printf work...

int WriteUARTN(void* bytes, unsigned long length);

// This gets called with a length of 1.

int ReadUARTN(void* bytes, unsigned long length )

{

    while(RX_EMPTY == Serial_rxbyte(0,(uint8_t *) bytes) )

       ;

    WriteUARTN(bytes, 1);

    return kUARTNoError;

}

int WriteUARTN(void* bytes, unsigned long length)

{

    Serial_txbuf(0,(uint8_t *)bytes, (uint16_t) length, 0);

    return kUARTNoError;

}

// Call other code to init UART, this is just to satisfy the linker...

int InitializeUART( int baudrate )

{

   return kUARTNoError;

}

Even if you just define them empty, it will solve the build problem for now.

0 Kudos

726 Views
lander
Contributor IV

I was able to build the project by initializing the variables with errors to 0.  Now, my program is interrupting (this interrupt PE_ISR(Cpu_Interrupt)) at the printf() statement.  I'm working on making sure that my device is set up correctly and such, any ideas on why it is interrupting there?

0 Kudos

726 Views
JimDon
Senior Contributor III

Which variables did you initialize to 0?

InitializeUART is a function. If you set it to 0 you would crash.

BTW You will not see these errors until you call printf in 10.3 release version.

0 Kudos

726 Views
lander
Contributor IV

I read the response wrong.  Okay, I left the functions empty and I'm getting multiple definition errors.  I can't seem to understand what is wrong.

Thank you for your help.

0 Kudos

726 Views
JimDon
Senior Contributor III

It' hard to help if you don't post the errors....

0 Kudos