PSoC 5lp Dual SPIM module don't working

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi friends

   

I'm using PSoC 5LP CY8C5868-AXI Psoc device. I need two spi modules in Psoc5 series. But I have a problem. 

   

I uploaded an image as an attachment. The circuit as shown in the picture. 

   

in this circuit the SPIM_1 module works fine, but the SPIM_2 module is not running. I use the following function to write data. 

   
    

       SPIM_2_WriteByte(0xAA);  //Write to SPIM_2 module
       while (0u == (SPIM_2_ReadTxStatus() & SPIM_2_STS_SPI_DONE)){} //wait for data send

   
   

What could be the problem? How many SPI modules can I use in this way?

   

Thanks

0 Likes
1 Solution
Anonymous
Not applicable

@hli

   

thank you for the reply. I'm resolved the problem. I forgot to start the SPI2 Module. 

   

But I do not understand the UDB resources. How do I calculate UDB usage? I want to know how UDB works. Is there a manual you can recommend?

View solution in original post

0 Likes
3 Replies
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

You can use as many SPI modules as can be put into the UDB resources of your PSoC5LP.

   

Looking at the code above - what is it that doesn't work? Is the loop never finished? In that case I would suspect that SPIM_2 is never started. Or its using a large buffer and you did not enable global interrupts.

0 Likes
Anonymous
Not applicable

@hli

   

thank you for the reply. I'm resolved the problem. I forgot to start the SPI2 Module. 

   

But I do not understand the UDB resources. How do I calculate UDB usage? I want to know how UDB works. Is there a manual you can recommend?

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Read the Architecture TRM for the PSoC5, it explains the UDBs in quite some detail. The SPI component data sheet shows in the technical spec how many UDBs are consumed. And Creator also has a resource meter which shows how many resources are consumed by your project.