PSoC 4: SPI SCB not working properly at high data transfer rates. Continuous mode fails.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
GaRo_3769926
Level 2
Level 2
First like given

Good morning everyone and thanks for reading this post

I'm trying to communicate a PSoC 4 (CY8CKIT-049-42XX, with the chip CY8C4245AXI-483) with an ADC (ADS7280) through SPI. I'll later use a CYBL10162-56LQXI chip.

I want to perform two types of writes to the ADS7280: a 4-bit write, and a 16-bit one. This has led me to use the 4-bit data size when configuring the SCB SPI component. I want the 16-bit write to be continuous, that is, without any changes in the Slave Select pin. This is the reason why I've used the "Transfer separation: continuous" mode, because according to the datasheet, this is exactly what it does.

When using the code that I've included in this post, I've had no luck making it work. Troubleshooting it, I've found that the Slave Select pin DOES change states when it should be down all time, and I've narrowed it down to a problem of high-frequency data transfers, since it only happens at 4mbps and not at 2mbps or the other lower frequencies that I've tried, as you can see in the pictures:

SPI_Low_Data_Rate.jpg

      Slave Select pin while sending four 4-bit packets at 2mbps data rate, transfer continuous mode

SPI_High_Data_Rate.jpg

      Slave Select pin while sending four 4-bit packets at 4mbps data rate, transfer continuous mode

I'm guessing the MCU can't put data into the TX FIFO fast enough, and the SPI component guesses that the transfer is over when in reality it shouldn't be.

Any other ideas why this happens? Any idea how to fix it? I'd rather not use DMA since the final chip I'll use doesn't have DMA.

Thank you a lot in advance.

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Did you ever try to increase the HFCLK to 48MHz? This will give the internal isr a bit more time to handle the buffer.

Bob

View solution in original post

2 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Did you ever try to increase the HFCLK to 48MHz? This will give the internal isr a bit more time to handle the buffer.

Bob

That's a good idea. I've tried it and it works. So, it's just a physical limitation after all, not much to do with such high frequencies with the component the way it's programmed.

I'd love to see a warning in PSoC Creator about this kind of problem since it's not an easy to troubleshoot one if you're not too much into the SPI protocol itself or you don't want to spend as much time as I did looking for the problem, and there's no warning in PSoC Creator or the datasheet (that I've seen) regarding problems with Transfer Continuous mode and high data rates.

Thank you for the solution Bob, it now works whereas it didn't previously. I'm proud that I can finally say Bob answered to one of my questions

Gabriel.

0 Likes