DSPRelated.com
Forums

Data types on SPI transfers

Started by alva...@gmail.com June 7, 2011
Hi,

I am working with C6727 DSP. To do a SPI transfer, I write SPIBUF-32bits register with an unsigned int-value. However, I am working with a word length of 8 bits, so how does it work? I mean, it is possible to write SPIBUF register with a 'smaller' data type (char, for example)?
Sorry, Im new with embedded programming.

Thanks in advance. Best Regards,
Alvaro

_____________________________________
There was a mistake, sorry. The register to write is SPIDAT0 instead of SPIBUF.

Hi,
>
>I am working with C6727 DSP. To do a SPI transfer, I write SPIBUF-32bits register with an unsigned int-value. However, I am working with a word length of 8 bits, so how does it work? I mean, it is possible to write SPIBUF register with a 'smaller' data type (char, for example)?
>Sorry, Im new with embedded programming.
>
>Thanks in advance. Best Regards,
>Alvaro
>
>_____________________________________

_____________________________________
Alvaro-

> There was a mistake, sorry. The register to write
> is SPIDAT0 instead of SPIBUF.
>
> Hi,
>>
>>I am working with C6727 DSP. To do a SPI transfer, I write SPIBUF-32bits register with an unsigned int-value.
>> However, I am working with a word length of 8 bits, so how does it work? I mean, it is possible to write SPIBUF
>> register with a 'smaller' data type (char, for example)?

Yes write char data. The C672x SPI Ref Guide is here:

http://focus.ti.com/lit/ug/spru718b/spru718b.pdf

First you want SPIDAT1 not SPIDAT0 -- according to the Ref Guide, writes to SPIDAT0 have "no effect". Second, section
A.1.14 mentions CHARLEN and right-justified writes to SPIDAT1.

-Jeff

_____________________________________
I tried before and it runs, I just ask to know how it works. Now I understand.

Thank you very much, Jeff.

Hi,
>
>I am working with C6727 DSP. To do a SPI transfer, I write SPIBUF-32bits register with an unsigned int-value. However, I am working with a word length of 8 bits, so how does it work? I mean, it is possible to write SPIBUF register with a 'smaller' data type (char, for example)?
>Sorry, Im new with embedded programming.
>
>Thanks in advance. Best Regards,
>Alvaro
>
>_____________________________________

_____________________________________