M0036 - Resource Limit Error  when adding SPI & UART module

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

cross mob
AsRa_264661
Level 4
Level 4
50 replies posted 25 replies posted 10 likes received

Hi All,

   

I am using SPI & UART in my project,

   

Initially i added  UART(v2.50) into my project , works everything as expected.

   

Later i added SPI Master Fullduplex macro  and getting this below error.

   

Pin guidance unavailable: Resource limit: Maximum number of Macrocells exceeded (max=32, needed=37).

   

If i add the originlal SPI Master (v2.50) aslo im getting same error

   

please provide me the solutions

   

 

   

Thanks,

   

Ashok R

0 Likes
17 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Your UART component uses UDBs, better is to take the SCB based UART. Same for the SPI component.

   

 

   

Bob

0 Likes
AsRa_264661
Level 4
Level 4
50 replies posted 25 replies posted 10 likes received

Hi Bob,

   

If i use SCB based UART , how do i can configure the UART reception ISR?

   

Also in SPI,

   

     SPIM_SpiUartPutArray(dummyBuffer, 3);    How do i can set register address here? and Data  to write ?

   

 

   

Thanks,

   

Ashok R

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

There is nearly no functional difference between the UDB and the SCB implementation except the GPIO pins are quite dedicated in the SCB version. Refer to datasheet.

   

 

   

Bob

0 Likes
AsRa_264661
Level 4
Level 4
50 replies posted 25 replies posted 10 likes received

Hi Bob,

   

I tried with SCB mode but could not getting interrupt on reception , here my code

   

int main()
{
    CyGlobalIntEnable; /* Enable global interrupts. */

   

    /* Place your initialization/startup code here (e.g. MyInst_Start()) */
    
    UART_1_SCB_IRQ_StartEx(UART_1_ISR);
    
    
    
    UART_1_Start();
       CyDelay(250);
    UART_1_UartPutString("AT\r\n");
    
    CyDelay(250);

   

    for(;;)
    {
        /* Place your application code here. */
    }
}

   

 

   

CY_ISR(UART_1_ISR){
    
    
   breakpoint...
       
    
}

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

Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

As I understood you: The breakpoint isn't reached?

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
AsRa_264661
Level 4
Level 4
50 replies posted 25 replies posted 10 likes received

Hi Bob,

   

Please find the project herem, also im getting some error after adding SCB SPI module.

   

please check

   

 

   

Thanks,

   

Ashok R

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

As I said in a previous post: "the GPIO pins are quite dedicated in the SCB version". Right click on the "Lock" header in the .cydwr view and select "Auto assign..." then build the project. You will get a working version. Then lock all pins and try manual pin assign when needed.

   

 

   

Bob

0 Likes
AsRa_264661
Level 4
Level 4
50 replies posted 25 replies posted 10 likes received

Hi Bob,

   

Yes , The Error is cleared now, but my issues is receiving the UART data on interrupt.

   

Thanks,

   

Ashok R

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

One after the other...  😉

   

You did not specify on which event the interrupt should fire, UART advanced page.

   

Just a tip: Increase the Tx buffer (if you like, the Rx buffer too) to something like 100..200. Thzen an interrnal interrupt jumps in and handles all for you. Use the GetTxBufferSize() (and GetRxBufferSize()) APIs to see how much is left (or already) in the queue.

   

 

   

Bob

0 Likes
AsRa_264661
Level 4
Level 4
50 replies posted 25 replies posted 10 likes received

Hi Bob,

   

I tried that also, but there is no option to set ISR for On receive of Every byte.

   

#ok

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

Rx fifo not empty would be a good candidate...

   

 

   

Bob

0 Likes
AsRa_264661
Level 4
Level 4
50 replies posted 25 replies posted 10 likes received

Hi Bob,

   

Now i used    UART_ESP_SetCustomInterruptHandler(UART_ESP_ISR);   instead of  UART_ESP_SCB_IRQ_StartEx(UART_ESP_ISR);  and intereupt on reception is working but want to know what is the use of

   

 UART_ESP_SCB_IRQ_StartEx(UART_ESP_ISR);  ?

   

Thanks,

   

Ashok R

0 Likes
AsRa_264661
Level 4
Level 4
50 replies posted 25 replies posted 10 likes received

Hi bob,

   

here my ISR code,

   

CY_ISR(UART_ESP_ISR){
     
    
    while(UART_ESP_INTR_RX_NOT_EMPTY  ){
        
        *RxWriteIndex++ = UART_ESP_UartGetByte();
    }
       
    
}

   

After reading all received data , UART_ESP_INTR_RX_NOT_EMPTY  flag not reseting to Zero, so the execution not coming out from the while loop.  Can you suggest any other way to read all the data from FIFO?

   

Thanks,

   

Ashok R

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

See page 99 of datasheet: You have chosen the SetCustomInterruptHandler() which is additional to the internal interrupt handler.

   

SCB_IRQ_StartEx() does not exist. When replacing the internal interrupt completely, by using external interrupt, a signal is generated where you can connect an isr component to. For this isr you may specify a handler using isr_StartEx();

   

 

   

Bob

0 Likes
AsRa_264661
Level 4
Level 4
50 replies posted 25 replies posted 10 likes received

Hi Bob,

   

Ok, Please tell me should i go with the CustomInterrupt handler? or  Default ISR ,

   

If default ISR means , what changes i need to do?

   

also provide me solution to below one, (right status register to come out from the loop after read all data)

   

while(UART_ESP_INTR_RX_NOT_EMPTY  ){
        
        *RxWriteIndex++ = UART_ESP_UartGetByte();
    }

   

 

   

#ok

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

As I suggested before:

   

Increase the Tx buffer and the Rx buffer to something like 100..200. Then the internal interrupt handles all for you. Use the GetTxBufferSize() and GetRxBufferSize() APIs to see how much is left or already in the queue.

   

When you like to handle the interrupts yourself write a "circular buffer" (Google for that).

   

 

   

Bob

0 Likes
AsRa_264661
Level 4
Level 4
50 replies posted 25 replies posted 10 likes received

Hi Bob,

   

I agreed that internal interrupts handles the receiving data , but i do not want to use polling to read data, want some callbacks to execute on interrupt ,  UART_ESP_SetCustomInterruptHandler(UART_ESP_ISR);  did that for me.

   

from this post http://www.cypress.com/forum/psoc-4-architecture/psoc4200-uart-interrupt-example

   

i got uart example code , which has the implemenation of ISR using UART_ESP_SCB_IRQ_StartEx(UART_ESP_ISR); 

   

this is the reason i confused. why its not working in SCB mode.

   

 

   

 

   

Thanks,

   

Ashok R

0 Likes