LPC SSP port modes not set correct

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

LPC SSP port modes not set correct

616 Views
götzfriedrich
Contributor I

Hello,

we found a bug in: "lpcopen_2_10_keil_iar_nxp_lpcxpresso_1769.zip\lpcopen\software\lpc_core\lpc_board\boards_17xx\nxp_lpcxpresso_1769\board.c" where the pin mode is not set correct for the SPI pins.

e.g. line 193:

Chip_IOCON_PinMux(LPC_IOCON, 0, 7, IOCON_MODE_INACT>>2, IOCON_FUNC2);

has to be used. In the original call the mode is not is downshifted but required for Chip_IOCON_PinMux() API call.

Attached corrected board.c file.

-Best regards, Götz-

0 Kudos
1 Reply

429 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Götz,

Thanks for reporting this bug!

As you mentioned each time you call the function Chip_IOCON_PinMux is necessary to make a downshifted ( >> 2 ) as you did for the SSP initialization in the line 193.  Chip_IOCON_PinMux(LPC_IOCON, 0, 7, IOCON_MODE_INACT>>2, IOCON_FUNC2);

To ensure the correct functionality of the drivers  the downshifted is necessary every time you call the function Chip_IOCON_PinMux, not only in the SSP initialization. If you don't make this the demo may work, but the values in the register PINMODE will be wrong.

A different solution is to declare new macros for the values of  MODE  without the shift. The IOCON_MODE_INACT macro expansion is the next:

#define IOCON_MODE_INACT        (0x2 << 2)

Once you make the downshifted (>> 2) in the Chip_IOCON_PinMux function call you are leaving the 0x2 only. So you can declare new macros in board.h instead, like the following:

#define PIN_MODE_INACT 0x02 
#define PIN_MODE_PULLDOWN 0x03 

...

And replace for the new macros in all the calls to function Chip_IOCON_PinMux. 

Chip_IOCON_PinMux(LPC_IOCON, 0, 7, PIN_MODE_INACT, IOCON_FUNC2);

It's important to mention that if you decided to declare new macros, you can't delete the old ones since other configuration requires that macros.

Have a great day, 

Victor.

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

 

0 Kudos