I Don't Know What I Did - CY8CKIT-049

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

I've probably spent about 13 hours straight programming today, the last two hours or so has been very strange, though. Everything working fine, problems obvious and only caused by me, most problems were with what I actually want it to do until... It just stopped... The software runs, I get serial over the usb, and I can do everything that's "pure" software. I can turn a software controlled pin on and off using the Pin_Write() function, I can call CyDelay just fine and software resets but for some reason nothing hardware based will work. My design has a timer, a PWM, a multiplexer, a control register, and they were all working perfectly fine. But now none of them work at all, if I hook up their outputs to a scope they only read whatever the pin's initial value is set to be.

   

Not having any idea what might be wrong I decided to use a little LED blinking program that blinks the onboard LED with a control register feeding into the output pin. But it just won't do anything. If I control the pin with software then it works just fine, but not a single piece of the schematic is working. I know it's not the device, because the bootloader blinks the LED just fine, still. It has to be me, I had to have done something.

   

Could anyone help me find out what I've done? Where do I even start to look? This problem is very bizarre and it's completely shut me down. All help is appreciated, if you need anything just tell me.

   

I'll upload that LED blinking project just

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

Use Timer_Start(), not Init()

   

The timer will deliver a pulse with only 50ns which you will probably miss with your MUX

   

Set initial state of pin component to 1 (High) in the property dialog. See datasheet of pin special section for PSoC4

   

 

   

You still did not update to latest version of Creator 3.0 SP2 My pin component is V 2.5

   

 

   

Bob

View solution in original post

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

Welcome in the fascinating (and sometimes complicated) world of PSoCs!

   

Your programmed loop in main()

   

    while(1)
    {
        CyGlobalIntEnable;    // This should be outside loop
        Serial_Start();            // ... and this as well because initialization is needed only once
       
        CR_Write(1);             // Write High to LED, on CY8CKit-049 will turn LED on
        CyDelay(1000);          // Wait one (1) second
        CR_Write(0);             // Turn LED off again
        Serial_UartPutString("\rTest\n"); // This will take less than 1ms, then the LED will be turned on again. Won't see with naked eye
    }
 

   

A hint: You may drive the pin directly without using a control register component by setting the pin's hardware connection to off.

   

 

   

    CyGlobalIntEnable;    //
    Serial_Start();            //
       
    while(1)
    {
        CR_Write(1);             // Write High to LED, on CY8CKit-049 will turn LED on
        CyDelay(1000);          // Wait one (1) second
        CR_Write(0);             // Turn LED off again
        Serial_UartPutString("\rTest\n"); // Write out text

   

        CyDelay(1000);         // Wait another second...
    }

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Ah, that was just a little mistake I made in that program. Remember the project I posted isn't the actual code I was working with, the project I posted was just something I threw together because of the problem.

   

So, using the following as you've posted:

   

    CyGlobalIntEnable;    //
    Serial_Start();            //
       
    while(1)
    {
        CR_Write(1);             // Write High to LED, on CY8CKit-049 will turn LED on
        CyDelay(1000);          // Wait one (1) second
        CR_Write(0);             // Turn LED off again
        Serial_UartPutString("\rTest\n"); // Write out text

   

        CyDelay(1000);         // Wait another second...
    }

   

With the project that I posted earlier, the program does not  work. It compiles/builds and programs onto the board just fine. The serial prints "Test" to a terminal every second as expected, but the LED's pin never changes from its initial state set as 1. If I use LED_Write();, then it works just fine, but for some reason CR_Write(); doesn't work. And neither do the API functions for any hardware block. That is my problem. And it's like this for every project I create, including past projects that once worked.

   

Any idea what this may be?

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

Can you then please supply us with the current version that shows the error, together with a description what exactly the error is. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

Maybe you can precise a bit which API's do not work as you expect.



Bob
 

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

What I've attached is from a workspace, which when programmed onto a CY8CKIT-049 yields an LED stuck in the on position, and sends out "Test" every second over serial at 115200 baud.

   

 

   

In my other project it seems I cannot get any functions from the Timer, PWM, Control Register, or Multiplexer APIs working. The UART, and non-hardware pin APIs work just fine.

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

You still have forgotten the second CyDelay(1000). Readf again the comments I made on your first post's code snippet.

   

 

   

Bob

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

"In my other project it seems I cannot get any functions from the Timer, PWM, Control Register, or Multiplexer APIs working."

   

Post one of the projects with the API in question and a bit of comment what you expect and what you observe and I'll have a look into.

   

 

   

Bob

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

Okay, I've removed everything I possibly could from the program with the issue, while still preserving the issue. I had to do this as I cannot share many aspects of the project. I have confirmed that on my board this project compiles, builds, but otherwise does not actually function. The LED does not change, and looking at pin P1.6 on a scope there is no change.

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

Use Timer_Start(), not Init()

   

The timer will deliver a pulse with only 50ns which you will probably miss with your MUX

   

Set initial state of pin component to 1 (High) in the property dialog. See datasheet of pin special section for PSoC4

   

 

   

You still did not update to latest version of Creator 3.0 SP2 My pin component is V 2.5

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thank you, setting the pin's initial value to HI fixed the issue, apparently I had all my pins initial values set to LOW. I don't understand exactly why that would cause an issue, but you can't argue with the results of having changed it.

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

As I wrote before: Have a look into the datasheet for the pin component and focus on the PSoC4 differences. An initial low will disable the pin.

   

Cypress's datasheets are always just a click away and are continuosly improved amdd imho always worth to have a deeper look into.

   

 

   

Bob

0 Likes