Interfacing Sharp LCD with K60

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Interfacing Sharp LCD with K60

跳至解决方案
1,265 次查看
nithinnagaraj
Contributor I

Hello, 

I am trying to interface LS013B7DH06 Sharp-memory LCD with K60 via SPI interface. I have written my spi_write function as follows,

{SPI2_PUSHR = ((SPI_PUSHR_CTAS(0x00)) | (SPI_PUSHR_PCS(63)) | (SPI_PUSHR_CONT_MASK) | SPI_PUSHR_TXDATA(0x20));
while(((SPI2_SR & SPI_SR_TCF_MASK) == 0));
SPI2_SR |= SPI_SR_TCF_MASK;
SPI2_SR |= SPI_SR_TFFF_MASK;
// end of queue
SPI2_PUSHR = ((SPI_PUSHR_CTAS(0x00)) | (SPI_PUSHR_PCS(63))| (SPI_PUSHR_EOQ_MASK) | (SPI_PUSHR_CONT_MASK & 0x00) | SPI_PUSHR_TXDATA(0x00));
while(((SPI2_SR & SPI_SR_TCF_MASK) == 0));
SPI2_SR |= SPI_SR_TCF_MASK;
SPI2_SR |= SPI_SR_TFFF_MASK;}

Lcd write is happening fine and i am able to write all my graphics api. Now when i try to write the SPI_Write Function using the following code, 

void bspSpiWrite ( uint8_t addr)
{
uint8_t buffer[1];
uint32_t data;
_mqx_int result;
buffer[0]= addr;  // (0x20) 0r (0x80)
result = fwrite( buffer, 1, sizeof(buffer), spifd);
if (result != 1)
printf("ERROR");
else
printf("OK");
fflush(spifd);
}

Now since its a complete MQX api (fwrite) and this is what i need to implement, my code is not working if i use the above function. May i request anyone to please explain me why it is working with 1st case and why not with 2nd? What is wrong with the 2nd function??

It would be a great if someone helps me out on this. 

Thanks in advance.

0 项奖励
回复
1 解答
1,110 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi Nithin:

Since I don't see your whole source, especially where you open this spi device , It is hard to locate the root cause. I would suggest you check the the chip select.

For more details, please see chapter 9.6,  Using the SPI driver

Freescale_MQX_4_2\doc\mqx\MQX_IO_User_Guide.pdf

For details how to implement SPI, please look at SPI example codel

Freescale_MQX_4_2\mqx\examples\spi

Regards

Daniel

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,111 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi Nithin:

Since I don't see your whole source, especially where you open this spi device , It is hard to locate the root cause. I would suggest you check the the chip select.

For more details, please see chapter 9.6,  Using the SPI driver

Freescale_MQX_4_2\doc\mqx\MQX_IO_User_Guide.pdf

For details how to implement SPI, please look at SPI example codel

Freescale_MQX_4_2\mqx\examples\spi

Regards

Daniel

0 项奖励
回复
1,110 次查看
nithinnagaraj
Contributor I

Thank you for the reply Daniel. 

0 项奖励
回复