EmbeddedRelated.com
Forums

Buffer size for SPI communication using MC20XS4200 in daisy chain configuration.

Started by semrade 3 years ago2 replieslatest reply 3 years ago101 views

Dear All Hello,

I am using the MC20XS4200 to control 6 outputs motor and bulb loads. The PCB board contains 3 MC20XS4200, each MC20XS4200 has 2 channels.

The MC20XS4200 are connected in daisy chain configuration, each MC20XS4200 has 13 register out and 13 register in. Each MC20XS4200 is controlled by its /CSB.

Since the MC20XS4200 are connected in daisy chain configuration, I have to send one buffer each 10ms task for all the MC20XS4200s to write, read and toggle WD to avoid reset.

My question is:

How I could calculate the buffer cache size?Capture d’écran 2021-06-26 105818.pngCapture d’écran 2021-06-26 105835.png

Thank you in advance,

S.Tarik

[ - ]
Reply by KocsonyaJuly 4, 2021

As these chips communicate using fixed 16-bit long SPI messages, if you daisy chain three of them, you need a 6 byte buffer. If you use separate transmit and receive buffers, that's 12 bytes.

What do you mean by "buffer cache"? 

Regards,

Zoltan


[ - ]
Reply by semradeJuly 4, 2021

Hello Zoltan,

The cache buffer is the buffer sent for each 10 ms task. This buffer will be sent even if there is no information to updates. Every time there is some register to be changed, I push this data to the cash buffer. In the release code, I have to maintain transmitting. the ship enters safe mode if no data is received after x ms. This configuration could be disabled in the debugging mode.

The idea is to have a generic driver if I add a ship to the hardware. I wouldn't work all the code.

The ship is 16bits SPI. I am using transmit and receive buffer.

I have made this small calculation but I am not sure:

  • 3 ships with 2 channels = 6 channels
  • Each channel has its register for reading and transmitting (_s) means that the register is duplicated. ==>13 IN and 13 OUT / ship.
  • 3ship*13In+13Out = 78 word of 16bits

Regards,

S.Tarik