SCB_SpiUartPutArray parameter type

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

cross mob
Anonymous
Not applicable

Hi All,

   

I have the following code:

   

 

   

int main()
{
    UART_Start();

   

    int len = 6;
    uint16 tx_array [len];

   

    for (;;)
    {
        tx_array [0] = 0xFFFF;
        tx_array [1] = 0x6C56;   
        tx_array [2] = 0x6461;  
    
        CyDelay (100);
        UART_SpiUartPutArray (tx_array, len);
    }
}

   

It works fine with Hyper Terminal, but IO have a warning of incompatible pointer type.

   

"passing argument 1 of 'UART_SpiUartPutArray' from incompatible pointer type"

   

According to the datasheet the function can take uint16 * or uint8 * as first parameter. What is more interesting GDB crashes when I want to look into the way UART transmits the data:

   

"/home/build/work/GCC-4-9-build/src/gdb/gdb/utils.c:1056: internal-error: virtual memory exhausted: can't allocate 1049375820 bytes.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable.\nCreate a core file of GDB? "

   

The only thing on the TopDesign is the UART component (SCB type).

   

Does anyone have any ideas about the warning and the crash?

   

Thanks,

   

Stoyan

0 Likes
1 Solution
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. You probably defined the UART as byte-wide, then you have to submit an array of bytes, not words.

   

 

   

Bob

View solution in original post

0 Likes
5 Replies
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. You probably defined the UART as byte-wide, then you have to submit an array of bytes, not words.

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi Bob,

   

What you suggest actually makes lots of sense 🙂 Here is the bundle.

   

Thanks,

   

Stoyan

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

The PSoC device you selected has a byte-wide UART only, so your data should be a (uint8*) or at least type-casted into that. Care using the right length, since that is counting bytes.

   

 

   

Bob

Anonymous
Not applicable

Hi Bob,

   

Thanks for the prompt reply. I will take into consideration that. Can you please point to me where you are getting the information about the UART.

   

Do you think that this may be the cause for the GDB crash?

   

Thanks,

   

Stoyan

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

where you are getting the information about the UART.

   

Datasheet for UART, always just a mouse click away 😉

   

Do you think that this may be the cause for the GDB crash?

   

Might be. the SCB (Serial Control Block) is a (programmable)  piece of hardware. When debugging, your program gets halted, but the hardware continues to run. That might lead to some curios behavior but I never saw a debugger crash. You are using Creator IDE and the integrated debugger, I presume?

   

 

   

Bob