cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

Anonymous
Not applicable
        Hello please look my workspace Why My LED is not Blinking ?   
0 Likes
Reply
34 Replies
Esteemed Contributor II

Different from your comment, the time you set initially is the very same time you set for the alarm. Install the 5 seconds difference and it might work.

   

 

   

Bob

0 Likes
Reply
Anonymous
Not applicable
        Hello about few hours ago My Pscoc creator was working very good. but now I am getting error message.'' device driver software was not successfully Installed'' Now I can't test program,   
0 Likes
Reply
Honored Contributor II

I have been looking at your program and I have found some issues.  I had to add a software UART to check if your program was working. I 1) found the clock is not running.  That is why your Alarm is not going off.  2) resistor is 560 ohms not 460 ohms. 3) Led was marked as a Diode not a LED.  3) You have the LCD on the wrong port. Port 2 is for analog per the PSOC Specs. It should be on Port 0 or Port 1. 4) You have not set the  LCD_Start(); in your program for the LCD. This is required for the LCD to be setup correctly. 5) Set alarm mask is not correct.   You should remove the seconds from the alarm by using this command  RTC_SetAlarmMask((unit32)~RTC_ALARM_SEC_MASK); Yours instruction is not doing that.  6) You are missing the CySysTickStart(); from your program.

   

7) Reboot your computer to see if that fixes your programming issue.

0 Likes
Reply
Anonymous
Not applicable

Hello

   

Look My another Project workspace. Its working but there is one problem. LED does not turn Off when Alarm is off

   

alarm should be On for 100 ms then turn off Alarm

   

if alarm is ON then LED should be On and if alarm is off , LED should be turn OFF 

0 Likes
Reply
Esteemed Contributor

You never clear the alarm flag when the alarm clears. Also you toggle the

   

LED rather than set it when flag is 1, clear it when flag is 0.

   

 

   

Regards, Dana.

0 Likes
Reply
Anonymous
Not applicable

when I put below code it works , when alarm is on , LED turn on for 5000 seconds and then turn off 

   


    void AlarmIsrHandler(void)
{
   
       alarmFlag = 1u;
       Alarm_LED_Write(1);
       CyDelay (5000);
       alarmFlag  = 0u;
 
       Alarm_LED_Write(0);
     
    /* Clear interrupts state */
    RTC_ClearAlarmStatus();
}

   

Now first alarm become true , how to set multiple alarm , you told me I need to create flag

   


    void AlarmIsrHandler(void)
{
   
       alarmFlag1 = 1u;
       Alarm_LED_Write(1);
       CyDelay (5000);
       alarmFlag1  = 0u;
 
       Alarm_LED_Write(0);
     
    /* Clear interrupts state */
    RTC_ClearAlarmStatus();
}

   


   
{
   
       alarmFlag2 = 1u;
       Alarm_LED_Write(1);
       CyDelay (5000);
       alarmFlag2  = 0u;
 
       Alarm_LED_Write(0);
     
    /* Clear interrupts state */
    RTC_ClearAlarmStatus();
}

0 Likes
Reply
Esteemed Contributor

You should not use large delays like that, wastes CPU time, accomplishes nothing.

   

CPU just burns power, does nothing else like monitor other activity, etc.....

   

 

   

Use a flag to control the alarm LED. Set when its on from alarm ISR, clear when it is alarm no

   

longer valid.

   

 

   

Regards, Dana.

0 Likes
Reply
Anonymous
Not applicable

 I am setting large delay to turn ON/OFF device for week , or months 

   

your reply is same as your previous  answer

   

suppose I want to set two alarms

   

so that I used two flags

   

alarmflag1

   

alarmflag2

   

   void AlarmIsrHandler(void)
{
   
       alarmFlag1 = 1u;
       Alarm_LED_Write(1);
       CyDelay (5000);
       alarmFlag1  = 0u;
 
       Alarm_LED_Write(0);
     
    /* Clear interrupts state */
    RTC_ClearAlarmStatus();
}

   

   
{
   
       alarmFlag2 = 1u;
       Alarm_LED_Write(1);
       CyDelay (5000);
       alarmFlag2  = 0u;
 
       Alarm_LED_Write(0);
     
    /* Clear interrupts state */
    RTC_ClearAlarmStatus();
}

0 Likes
Reply
Anonymous
Not applicable

ok I will try

   

also I have other issue actually I have used one flag in my program In which I am controlling LED

   

example :

   

 

   

   void AlarmIsrHandler(void)
{
   
       alarmFlag = 1u;
       Alarm_LED_Write(1);
       CyDelay (5000);
       alarmFlag  = 0u;
 
       Alarm_LED_Write(0);
     
    /* Clear interrupts state */
    RTC_ClearAlarmStatus();
}

   

how to use two flags for two alarms ?

   

flag1 ( first alarm)

   

flag2 ( second alarm )

   

how to execute alarm one by one ?

0 Likes
Reply
Honored Contributor II

Vead your clock is running extremely fast. About 8 minutes for each real minute.  I check this with a stop watch and was not able to get a good start time but my readings are at least 8 or more minutes too fast. I have to ask why you have not used the programs I have sent to you in the past? They are running at the correct time.  I'll be modifying a working program and see it to you.

0 Likes
Reply
Anonymous
Not applicable

I saw that Program , I don't have Miniprog, also I don't want to use ds1307 because RTC software component can work. so why we use ds1307. I don't care If some time loss occur. yes the clock is running very fast. I want to ask you, there is any way sothat we can get accurate time

0 Likes
Reply
Honored Contributor II

I am not talking about the DS1307 clock program. This is a PSOC program that has a good clock source from the PSOC chip that is okay but not as good as a Crystal clock source. I should have the program done by later today. Do you want the LCD device on the program? if so I'll add that to the program an put it on the correct port.

0 Likes
Reply
Anonymous
Not applicable

Hello bobgoar

   

I want to see your program. yes I want  to show resulat on LCD . If possible please set alarm for two different date. I am just waiting to see your program for accurate time  

0 Likes
Reply
Esteemed Contributor

Using onboard OpAmp build a 32 Khz oscillator using external xtal.

   

 

   

http://www.edn.com/design/analog/4396957/Crystal-oscillator-circuit-is-ultralow-power

   

 

   

Regards, Dana.

0 Likes
Reply
Esteemed Contributor

Scratch the prior post, I do not think there is any way to route the 32 Khz from

   

an external pin to the RTC. Although datasheet states update of RTC can be mapped

   

to a number of different interrupts. Possibly feed the external osc to a pin with an

   

interrupt tied to it ? And mapped to the RTC ? Not sure if that would work. Possibly

   

use the pin interrupt to register write and initiate in the ICU an interrupt the RTC

   

can use.....

   

 

   

The other way is to use a method during production test to cal the chips LO.

   

 

   

Whats the accuracy target you have ?

   

 

   

Regards, Dana.

0 Likes
Reply
Honored Contributor II

VEAD: Here is a way to add a crystal to your CY8CKIT_049-42XX PSOC 4 Prototyping kit. http://www.cypress.com/file/140221/download and this document http://www.cypress.com/knowledge-base-article/implementing-32-khz-eco-interface-psoc-4100psoc-4200-k.... This will make your clock very accurate.  I am working on the program still I had a computer failure and changed to  another machine.

0 Likes
Reply
Esteemed Contributor

The crystal you use has recommended C loading you should follow. Also keep

   

in mind pin C factors into the C you choose. Additionally the series equiv of

   

the two Cs used to load should equal the recommended loading. In other words

   

if xtal wants a 10 pf load, use two 20 pf caps. Essentially you have a tank circuit

   

consisting of the two caps in series in parallel with the xtal operating in its inductive

   

mode on its phase/Z curve.

   

 

   

Regards, Dana.

0 Likes
Reply
Anonymous
Not applicable

you mean I have to use psoc 4 software component,  two capacitors and one 32 khz oscillator.I have added two capacitors and one 32 khz oscillator on Top design. but how to route all components ?

0 Likes
Reply
Esteemed Contributor

Something like this, attached. The passives are not actual chip routes, just

   

a way of documenting external components. You would add the 2 caps, and

   

the R bias network, and the R used to limit xtal "activity", Pdiss.

   

Note the pic shows Hysteresis enabled, I would disable that in

   

Comparator properties.

   

 

   

 

   

Regards, Dana.

0 Likes
Reply
Honored Contributor II

Vead I was thinking that you might want to upgrade to a CY8CKit-044 PSOC 4M Pioneer kit it has a 32.768kHz crystal already installed. Also the CY8CKit-042 Ble Kit also has a 32.768 kHz crystal installed.   Or you could also consider a CY8CKit -049 PSOC 5LP Prototyping kit.  The issue with the PSOC 5 LP is that it uses and different RTC component and it seems a little harder to use.  The other kits would work out of the box.  I do not know if these are within your budget however.  The clock circuit for the CY8CKIT-049 PSOC 4 PROTOTYPING KIT is very easy to setup you just need a few resistors and two caps and the WCO crystal.

0 Likes
Reply
Honored Contributor II

Here is the crystal program it has no clock and was just added to the led blink for the example on now to make the crystal work on the PSOC Prototype kit. 

0 Likes
Reply
Anonymous
Not applicable

Hello Mr. bobgoar

   

If I am not wrong ,  I have to add the your crystal program in my RTC program to see accurate time. may be it looses about 5-8 minutes in  a day , its ok, when I open your project  there is error ''Unable to find component "cy_boot_v5_10".  how to remove that error

0 Likes
Reply
Honored Contributor II
        What version of Psoc Creator are you using? This was made on Psoc Creator 3.2.   
0 Likes
Reply
Honored Contributor II

What version of Psoc Creator are you using? This was made on Psoc Creator 3.2. SP1  Sorry for the duplicate post. My Phone caused this.

0 Likes
Reply
Anonymous
Not applicable

I am using PSoCCreatorSetup_3.2_es10-4_4-2-15

   

when I don't use bootloadable component I saw three error , if I use botloadable component I saw two error

   

common error is ''Unable to find component "cy_boot_v5_10".

   

also I just want to confirm that if I add  your clock program  in my RTC program , can we get the accurate time ?

0 Likes
Reply
Esteemed Contributor

Just using the comparator interrupting at a 32 Khz rate maybe not best method,

   

if resources permit divide 32Khz down to 1 pps or .1 with a timer and use an

   

interrupt on its Tc pin to update the RTC. That leaves more MIPS for other tasks.

   

Although disadvantage is cannot be in sleep, timer not running, in that case the

   

comparator in sleep can generate an interrupt, but 32Khz rate obviates the whole

   

idea of sleep.

   

 

   

Regards, Dana.

0 Likes
Reply
Honored Contributor II

VEAD: Dana is right about using the crystal using the PSOC 4 comparator hardware will not work in the sleep mode and you also have too consider what to do when your PSOC 4 is powered down the RTC clock will stop. 

0 Likes
Reply
Esteemed Contributor

It was the Timer I felt would not be operating, but I correct myself. In sleep

   

it also will run  as well as the comparator. See attached table.

   

 

   

http://www.cypress.com/documentation/application-notes/an86233-psoc-4-low-power-modes-and-power-redu...         AN86233 - PSoC® 4 Low-Power Modes and Power Reduction Techniques

   

 

   

Regards, Dana.

0 Likes
Reply
Anonymous
Not applicable

Hello 

   

I don't have much knowledge about psoc kits ,. I saw your project , there are crystal ,  comparator, capacitor and registers , I tried to understand  , when I open that project  It show the error

   

sorry but I don't understand  what's happening.  I know  we are setting clock, exactly what we need ?

0 Likes
Reply
Honored Contributor II
        Vead: You need to add the caps,resistors, and crystal the comparator and timer is in the Psoc 4 chip.. Have you tried the update components under the project tab to fix the error?   
0 Likes
Reply
Honored Contributor II

Vead I tried the program from the Cypress website that I downloaded to you for the Crystal and it worked fine once I Put the correct >hex and .elf for the dependencies for the bootloadable component and it compiled without errors with one warning P1(4) not used in the design.  So the program would work if you had the parts.  I think it would be best for you to get  a board with the crystal already installed in the design  such as a CY8CKIT-044.  I have been thinking about the two alarms and the program will not let you define 2 alarms with the same name a #define Alarm_hour (0X03u). So I think the 2nd alarm should be defined in the void AlarmISRHandler(void) function as you never return to the Main() part of the program after the first run.  So I think the New alarm should be NAlarm_HOUR (0X04u) and so on. I tried to redefine the Alarm_hour but the program would not allow it.  That is why the name has to be changed.  Also some type of loop needs to be install in the ALarmISRHandler function to prevent the reassignment of the Alarm names.   By the way I have been running the CY8CKIT-049_42XX using the system tick as a clock and it has been keeping pretty good time it has not lost or gained more that 2 minutes in 3 days. That may work for your needs. I do not know how accurate your design needs to be.

0 Likes
Reply
Anonymous
Not applicable

 If 2-4  minutes lost in one day its good. . Please Can you upload your project  so that I can see result 

0 Likes
Reply
Esteemed Contributor

There is a PSOC Creator 101 series set of videos you can train on,

   

look at the older ones first.

   

 

   

http://www.cypress.com/video-library/PSoC-Software

   

 

   

Regards, Dana.

0 Likes
Reply
Honored Contributor II

Vead I am using PSoC Creator  3.2 SP1 (3.2.0.6175) so it looks like you are behind my version. That explains the issue you had with the cY boot.

0 Likes
Reply