SSP Loopback mode problem

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

SSP Loopback mode problem

1,898 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by faizal on Wed Jun 22 05:10:16 MST 2011
Hello,

     Im very new to micro-controller world. As part of my internship program, I want to program lpc114 for ssp loopback mode. I use the example code in LPCXpresso Example Projects for LPC1114/302. I changed

#define LOOPBACK_MODE        1
#define SSP_SLAVE0
#define TX_RX_ONLY0

Then I changed :

#define USE_CS1
#define SSP_DEBUG1

I used SSP_DEBUG=1 because I want to use hyperterminal to check whether it works or not. The problem is when i want to debug ssp, I got error said that Undefined Reference for UARTInit(),UARTsend() in the file ssp_main.c.

I don't really understand the problem because at the top of ssp_main.c, we've already included uart.h :

#if SSP_DEBUG
#include "uart.h"
#endif

I've verified in folder called "driver",there are file uart.c and uart.h Please help me with this problem.

Thanks,
Faizal
0 Kudos
Reply
6 Replies

1,833 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Europe on Mon Jun 27 15:24:47 MST 2011
Hello faizal,

As Zero explained, parts of your software can be 'shielded' and is not compiled. Can be handy during testing.

Examples:

#if 0 // mind the '0'
i = i + 1; // this line is not compiled
#endif

#if 1 // mind the '1'
i = i + 1; // this line is compiled
#endif

/*
i = i + 1; // this line is not compiled and seen as text
*/

Many examples can be found that explain the mechanism.
0 Kudos
Reply

1,833 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by faizal on Thu Jun 23 02:40:28 MST 2011
Hello,

  Thanks a lot for your help. I've succeeded to simulate the loopback mode on LPC1114.
0 Kudos
Reply

1,833 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Jun 22 08:43:43 MST 2011
This is Conditional Compiling :eek:
=
Everything between #if and #endif is included if condition after #if is true.
Otherwise it's excluded and your compiler isn't using it (and editor shows gray background) :eek:
0 Kudos
Reply

1,833 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Wed Jun 22 08:12:35 MST 2011
An Undefined Reference is a link-time error. It is normally caused because you are not linking with a required library.
0 Kudos
Reply

1,833 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by faizal on Wed Jun 22 08:10:05 MST 2011
Hello,

     Yes,the file uart.h starts with :

[PHP]#if CONFIG_ENABLE_DRIVER_UART==1[/PHP]

So what is exactly the problem? I'm so sorry for my silly question. This is my first time doing programming with micro-controller.:(
0 Kudos
Reply

1,833 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Jun 22 05:28:28 MST 2011
...and uart.h starts with:

#ifndef __UART_H 
#define __UART_H
 
[COLOR=Red]#if CONFIG_ENABLE_DRIVER_UART==1[/COLOR]
....
:eek::eek:
0 Kudos
Reply