LPC18S37 and SSP1 clock signal issue

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

LPC18S37 and SSP1 clock signal issue

Jump to solution
1,020 Views
sener
Contributor II

Hi,

I have a custom board with LPC18S37 and an LCD connected via SPI (only MOSI, SCK, CS and DC).
Since I couldn't have success on interfacing LCD, I've started to troubleshoot hardware and software respectively. Hardware side seems to be alright and I've started to look in the code.

I am using files from NXP for drivers and examples (you may see them attached).

Here is the simplified code from my work;

lpc1850_db1.h

 

#include "/Drivers/Include/lpc18xx_scu.h"

/*
HW Name  PinName    TFBGA100	Name	       Type    Func   Port     Pin
LCD_L_CS      P1_0	H1	GPIO0[4]	I/O	1	0	4
SSP1_SCK      PF_4	H4	SSP1_SCK	I/O	1	
SSP1_MOSI     P1_4	J2	SSP1_MOSI	I/O	6	0	11
*/

#define LCD_L_CS_SCU_CONFIG       0x1, 0, MD_PLN, FUNC0 // LCD_L_CS
#define LCD_SCK_SCU_CONFIG        0xF, 4, MD_PLN_FAST, FUNC0 // SSP1_SCK
#define LCD_MOSI_SCU_CONFIG       0x1, 4, MD_PUP | MD_EZI | MD_ZI, FUNC5 // SSP1_MOSI

#define LCD_L_CS_SCU_PORT     0x1
#define LCD_L_CS_SCU_PIN      0
#define LCD_L_CS_GPIO_PORT    0
#define LCD_L_CS_GPIO_PIN     4
#define LCD_L_CS_GPIO_MASK    (1 << LCD_L_CS_GPIO_PIN)

 

 

main.c

 

#include "RTOS.h"
#include "LPC18xx.h" // Device specific header file, contains CMSIS
#include "LCDST7735.h"
#include "LCDMain.h"
#include "Common.h"
#include "/Drivers/Include/LPC18xx_ssp.h"
#include "../OS/Setup/Boards/lpc1850_db1.h"

SSP_CFG_Type SSP_ConfigStruct;

scu_pinmux(LCD_SCK_SCU_CONFIG);
scu_pinmux(LCD_MOSI_SCU_CONFIG);
// initialize SSP configuration structure to default
SSP_ConfigStructInit(&SSP_ConfigStruct);

// Initialize SSP peripheral with parameter given in structure above
SSP_Init(LPC_SSP1, &SSP_ConfigStruct);

// Enable SSP peripheral
SSP_Cmd(LPC_SSP1, ENABLE);
OS_Delay(200);

 

 

The rest of the code, LCD related command and data.

Here is the shot from the scope which I find it very interesting.

LPC18S37 LCD SPI driver trial - LCS looks like a clok - hmmm 2.png

Looks like SCK and LCS (CS actually) are switched their places. I thought that I swapped the probes by mistake. No, it wasn't actually, they were correct. I've also traced back the connections up until the LPC18S37 pins. They are also correct.

From this point, before I continue my troubleshooting on the LCD interfacing, I like to understand what happens here. For example, am I making a mistake in pin muxing and it is resulting in this issue? Any pointer greatly appreciated.

Labels (1)
Tags (2)
0 Kudos
1 Solution
955 Views
sener
Contributor II

For whom has a similar issue, I mark my solution here.

I solved the issue with SPI and LCD at the same time. It was just a missing line. Since my LCD doesn't need the MISO line, I have just ignored it since the beginning. Reading after reading, although it wasn't clearly written anywhere, I finally came to a conclusion that MISO line has to be setup anyway. I did so and It worked!

You must pinmux MISO line!

 

 

#define LCD_MISO_SCU_CONFIG       0x1, 3, MD_PLN | MD_EZI | MD_ZI, FUNC5  // SSP1_MISO
scu_pinmux(LCD_MISO_SCU_CONFIG);

 

 

 

Note that: Besides, although things are working OK now, I have still more or less same scope output. So, don't ask (I don't ask anymore) why the scope output is like that which was my original question.

Best regards,
Sener

View solution in original post

0 Kudos
4 Replies
956 Views
sener
Contributor II

For whom has a similar issue, I mark my solution here.

I solved the issue with SPI and LCD at the same time. It was just a missing line. Since my LCD doesn't need the MISO line, I have just ignored it since the beginning. Reading after reading, although it wasn't clearly written anywhere, I finally came to a conclusion that MISO line has to be setup anyway. I did so and It worked!

You must pinmux MISO line!

 

 

#define LCD_MISO_SCU_CONFIG       0x1, 3, MD_PLN | MD_EZI | MD_ZI, FUNC5  // SSP1_MISO
scu_pinmux(LCD_MISO_SCU_CONFIG);

 

 

 

Note that: Besides, although things are working OK now, I have still more or less same scope output. So, don't ask (I don't ask anymore) why the scope output is like that which was my original question.

Best regards,
Sener

0 Kudos
958 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

Compare with the configuration with SSP demo, and confirm your connection .

 

 

0 Kudos
985 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Helllo sener,

If pin mux configuration like your below comment, it is wrong. 

/*
HW Name  PinName    TFBGA100	Name	       Type    Func   Port     Pin
LCD_L_CS      P1_0	H1	GPIO0[4]	I/O	1	0	4
SSP1_SCK      PF_4	H4	SSP1_SCK	I/O	1	
SSP1_MOSI     P1_4	J2	SSP1_MOSI	I/O	6	0	11
*/

 Alll the Func number need subtract  1. 

Alice_Yang_0-1638241994881.png

Alice_Yang_1-1638242024090.png

 

BR

Alice

 

0 Kudos
979 Views
sener
Contributor II

Thank you for your response Alice.

But, I can't see if it is wrong with the function number.

/* Pin function */
#define FUNC0 0x0 /** Function 0 */
#define FUNC1 0x1 /** Function 1 */
#define FUNC2 0x2 /** Function 2 */
#define FUNC3 0x3 /** Function 3 */
#define FUNC4 0x4
#define FUNC5 0x5
#define FUNC6 0x6
#define FUNC7 0x7

LCD pinmux-Sener.png

0 Kudos