Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 09:59 19 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : SPI Problem

Author Message
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 815
Posted: 11:47pm 14 Jul 2013
Copy link to clipboard 
Print this post

Hi everyone.

I have to communicate with a TMC429 Steppercontroller via SPI.
The registers are 32 Bits long! I read in the manual that the Bit-Range is limited to 23 because the range is limited by how many bits can be stored in a floating point number.
I thought a single precision floating point number has 32 Bits???
Is there another way to send 32 Bits over SPI???

THANKS FOR HELP!!!

Frank
 
Dylan
Regular Member

Joined: 17/06/2013
Location: Netherlands
Posts: 81
Posted: 12:11am 15 Jul 2013
Copy link to clipboard 
Print this post

According to Appendix D, SPI sends bytes. But I'll leave it to experts on MMBasic and/or SPI.

A single precision floating point number has 32 bits. Your problem is that some of these are used for the mantissa, and some for the exponent (and 1 for the sign). http://en.wikipedia.org/wiki/Ieee_float#Basic_formats and all that.
 
MM_Wombat
Senior Member

Joined: 12/12/2011
Location: Australia
Posts: 139
Posted: 10:10pm 15 Jul 2013
Copy link to clipboard 
Print this post

Frank,

When I had to send 32 bits to some chips via spi then I just sent two lots of 16 bits before I reset the latch.

ie
'32 bits to send &hff88
temp1=&hff
temp2=&h88

Pin(17) = 0 'assert the enable line (active low)
junk1 = SPI(18, 19, 20, temp1, H, 0, 16)
junk1 = SPI(18, 19, 20, temp2, H, 0, 16)
Pin(17) = 1 'reset the enable line (inactive high)

maybe that would work..

Later I added some code to the source called spiDMD() which sent 32 bits each time, but was written to mirror the vga output to a Dot Matrix Display (DMD).

Dennis

[edit]
I assume the latch is the nSCS_S pin, with the clock as SCK_S and SDI_S as data in with SDO_S as data out..
from the datasheet

[/edit]Edited by MM_Wombat 2013-07-17
Keep plugging away, it is fun learning
But can be expensive (if you keep blowing things up).

Maximite, ColourMaximite, MM+
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 815
Posted: 08:42am 16 Jul 2013
Copy link to clipboard 
Print this post

Hello Dennis,

thank you very much!

Your code works very well!!!

I send four bytes with 8 bits with your (modified) code and can read all registers, I am very happy!

Thanks again!

:)Frank
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024