Lpc1796 ssp/ssi

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

Lpc1796 ssp/ssi

1,352 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by timer on Thu Jan 26 16:36:24 MST 2012
Hello,

I try to read with SSI (SSP) from an Sensor. With my Oszi I can see the data is comming but I dont find all the 16bits.

Actually I this routine with Length = 1 because the I get one clock-"burst" with 16 periodes.

void SSP1Receive(uint8_t *buf, uint32_t Length )
{
uint32_t i;

    for (i=0; i<Length; i++)
    {
        // send a dummy byte, read the result
        LPC_SSP1->DR = 0xFF; // send 0xFF as dummy

        /* Wait until the Busy bit is cleared */
        while ( (LPC_SSP1->SR & (SSPSR_BSY|SSPSR_RNE)) !=  SSPSR_RNE );
        *buf++ = LPC_SSP1->DR;
    }
    return;
}


This Code is form the SSP-Example but I get as you may expect only one 8bit value in the buffer.
But I need 16bit. I try to change the *buf to a uin16_t because I think I have to use the whole accessable DR-Register, but come into the "HardFault_Handler" and had to reset.

Does anybody know how I can get the whole 16bits data?

Thanks, Tim
0 项奖励
回复
5 回复数

1,319 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by timer on Fri Jan 27 09:55:39 MST 2012
I found a way that it works.
Now I use 3 times 6-bit and get all my needed bits out of them.

Thank you for your help :)
0 项奖励
回复

1,319 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by timer on Fri Jan 27 05:26:13 MST 2012
Thanks,

with two times 8-bit I get good looking data. But they are shifted one bit so the first bit should be the even parity, but it don't look like :(

This is the datasheet from the IC in the Sensor:  Datasheet
0 项奖励
回复

1,319 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Jan 27 00:32:17 MST 2012
I'm not sure what your sensor is expecting

Of course chip select is always an issue, but if you switch off SSEL function and use CS via GPIO it could be possible that 2*8bit is working.
Otherwise you have to extend your SSP receive function to receive 16 bit :eek:

If your data register (LPC_SSP1->DR) is already able to receive correct 16 bit data you could also store them as 2 bytes in your byte buffer with something like:

*buf++ = (LPC_SSP1->DR>>8) & 0x0FF; //store byte 1
*buf++ = (LPC_SSP1->DR) & 0x0FF;    //store byte 2
0 项奖励
回复

1,319 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by timer on Thu Jan 26 23:53:14 MST 2012
Hi Zero,

the DSS is set to 1111 for 16-bit.
I could try to put it on 8-bit and change Lenght = 2.

Now I have now know time to test it, but, could this work?
0 项奖励
回复

1,319 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Jan 26 16:49:03 MST 2012
What's your DSS value?
0 项奖励
回复