Because you are not "assigning" a speed.  You are setting a "maximum" 
speed, and the system is free to generate any standard available frequency 
slower than the maximum.

Because of the clock divider chains feeding the SPI, it is not possible to 
generate any arbitrary speed.  You may be able to get closer to what you 
want by bit banging the registers inside of the Sitara.  If you are able to 
hit some specific speed, consider yourself very lucky.  Time to get out the 
Sitara data sheet and start reading.

--- Graham

==

On Friday, June 26, 2015 at 8:18:59 AM UTC-5, marti...@gmail.com wrote:
>
> Hello Guys,
>
> I'm new at programming the BBB and to Linux in general, so I'm trying to 
> figure out what's happening when I'm setting up a SPI-connection.
>
> I have set up a SPI-connection, using a Device Tree Overlay, and I'm now 
> running spidev_test.c 
> <https://www.kernel.org/doc/Documentation/spi/spidev_test.c> to test the 
> connection. For the application I'm making, I need a quite specific 
> frequency. So when I run spidev_test and measure the frequency of the bits 
> shiftet out, I don't get the expected frequency.
>
>
> <https://lh3.googleusercontent.com/-51vFiUpWoX4/VY04yMt1RfI/AAAAAAAAAJc/Lbg4QOm8y8s/s1600/BBB%2Btransmit%2B0xAA%2B%2540%2B4MHz%2B-%2Bedit.png>
>
>
> I'm sending a SPI-packet containing 0xAA, and in spidev_test I've modified 
> the "*spi_ioc_transfer.speed_hz*" to 4000000 (4MHz). But I'm measuring a 
> data transfer frequency of 2,98MHz. I'm seeing the same result with other 
> speeds as well, deviations are usually around 25-33%. 
>
>
> *How come the measured speed doesn't match the assigned speed?*
>
> *How is the speed assigned in "speed_hz" defined?*
>
> *How precise should I expect the frequency to be?*
>
>
> Thank you :)
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to