This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3358: Setting SPI bus rate

Part Number: AM3358
Other Parts Discussed in Thread: MSP430F149, TLV5616

Dear TI Support,

I'm designing an industrial control system based on the Beaglebone Black Rev C that has a 4-20mA current loop. One SPI Bus will be dedicated to the 4-20mA loop transmitter and the other will be dedicated to the 4-20mA input. 

I see that the SPI Bus Clocks are all integer dividers of 48MHz.

On the transmit  side, this makes it impossible to generate the SPI bus clock frequency that would work for many of the standard serial transfer rates I.e. 19.2K for a 16-bit transfer would require a baud rate of 3.072MHz, which is not an integer quotient of 48MHz. The closest data rate I can get to is 3MHZ, which makes for a data rate of 18.75kbs, which is too far away from 19.2Kbps Error = (18.75/19.2) -1 = 2.3% I need less than 2%

Is there a way to change the 48MHz clock that drives the SPI Bus?

Thank you very much for all of your help and support.

Jeff Cohen

Hytorc

  • Hi,

    The McSPI functional clock is taken from the Peripheral PLL M2 output (192MHz) and then divided by 4 (48MHz). To change this frequency you have to change the Peripheral PLL frequency, and this will affect the all subsystems that are clocked by it (practically all device peripherals). In short, it's strongly recommended not to try changing this frequency.

    I don't understand why you are worrying about the 19.2K (by the way is this kilobits or kilosamples per second)? In your case the AM335x is the SPI Master and the Slaves will work at whatever SPI clock they are fed, as long as it's within their operating limits.
  • Hi,

    Thank you very much.  I agree that it makes sense not to change the value of the PLL M2 frequency of 192MHz.

    Please allow me to explain that there is a discrepancy between the desired SPI bus clock frequency and the actual attained frequency.On the transmit side I am okay up to 230.4kbs.  Most receivers specify a 2% error rate. The  table below shows the data rate, the desired SPI Clock frequency and the error rate. Note that Error rate =[ 1 - (actual/desired)]X 100]. 

    Data Rate

    Desired SPI Bus Clock *16 Frequency

    Divisor Value

    Actual SPI Bus Clock  Frequency

    Actual Data Rate

    Error %

    2400

    38400

    1250

    38400

    2400

    0

    4800

    76800

    625

    76800

    4800

    0

    9600

    153600

    312.5

    153846.15

    9615.4

    0.16

    14400

    230400

    208.33

    23079

    14423

    0.16

    19200

    307200

    156.25

    307692

    19231

    0.16

    38400

    614400

    78.125

    615385

    38462

    0.16

    57600

    921600

    52.083

    923077

    57692

    0.16

    115200

    1843200

    26.0416

    1846154

    115385

    0.16

    230400

    3686400

    13.0283

    3692308

    230769

    0.16

    460800

    7372800

    6.51

    6857143

    428571

    -7.0

    921600

    14745600

    3.255

    16000000

    1000000

    8.6

    Regards,

    Jeff

    Hytorc Inc. Mawah, NJ USA

  • Do you mean that the SPI slaves (4-20mA peripherals) require a continuous SPI clock? Can you specify the part numbers, or post datasheets?
  • Hi,

    The clock is not continuous. IT is only active during transmission of data over the 4-20mA loop. Typically this type of communications is handled by an MSP430 micro-controller.

    The system looks similar to that which is shown in Figure 1 of "Using SPI Synchronous Communications With Data Converters: Interfacing The MSP430F149 and TLV5616"
    Link: www.ti.com/.../slyt137.pdf

    The SPI bus is usually idle, and whenever there is a packet of serial data, the data is transferred in a burst, and on every 16th data transfer, the data is loaded into the DAC and converted. Can you think of a better approach?

    Regards,

    Jeff
    Jeff Cohen: Hytorc INc, Mawah, NJ USA
  • What I don't understand is why the data should be transferred at exactly these baudrates. The table above is true for UART interfaces, which are asynchronous, but SPI data is clocked in the slave device by the master clock.
  • Hi,

    You are right. The baud rate does not matter. These sensors are not intelligent devices. They are analog transducers. 

    I was under teh impression that they can carry data too. I was mistaken. 

    Thank you very much for pointing this out to me. 

    Regards,

    Jeff