HOW To Genaerate 500ms timer interrupt using psoc4 BLE

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

cross mob
Anonymous
Not applicable

Hi,

i want to generate a 500ms timer interrupt  .

can anyone suggest me how to select clck frequency,prescaler,period,cmp value

Thnaks in advance

0 Likes
1 Solution
Anonymous
Not applicable

Using the TCPWM Component as a down counter, the counter decreases with the frequency of the input clock (if prescaler is 1x) from the period value to 0.

So for your example you could select a 1kHz clock and a period of 500. (Prescaler 1x, compare does not matter, interrupt on terminal count). After 500 ticks (At 1kHz -> 0.5 seconds) you would get an interrupt.

The following code example demonstrates blinking an LED every second with a Timer. Can be easily modified for 500 ms.

CE210557 - PSoC® 4 Timer Interrupt | Cypress Semiconductor

Regards,

View solution in original post

0 Likes
18 Replies
Anonymous
Not applicable

Using the TCPWM Component as a down counter, the counter decreases with the frequency of the input clock (if prescaler is 1x) from the period value to 0.

So for your example you could select a 1kHz clock and a period of 500. (Prescaler 1x, compare does not matter, interrupt on terminal count). After 500 ticks (At 1kHz -> 0.5 seconds) you would get an interrupt.

The following code example demonstrates blinking an LED every second with a Timer. Can be easily modified for 500 ms.

CE210557 - PSoC® 4 Timer Interrupt | Cypress Semiconductor

Regards,

0 Likes
Anonymous
Not applicable

Thanks  a lot sir,

it's working

0 Likes
Anonymous
Not applicable

Hi sir,

can you tell me how we have to get the required timer inteerupt based on i/p clk and prescaler and period value

i gone through the "TIMER_Intterupts" datasheet but in that details hasn't given

can u provide the proper document

Thanks in advance.

0 Likes
Anonymous
Not applicable

if i want to generate the 2.5 sec interrupt ,then what are my settings

0 Likes
Anonymous
Not applicable

Using interrupt on terminal count.

Interrupt period = (Period Value * Prescaler) / Input clock frequency

2.5 seconds = (2500 * 1) / 1000 Hz

Anonymous
Not applicable

Thanks for ur reply sir..

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

i want to send the rtc time stamp to the mobile. And i able to send this.but the problem is while programming the chip the RTC takes the internal time

and it starts updating.But i want to set my own time not the psoc time i.e, my time is  10:10:10(H:M:S)

even if i use below API'S to set the time  it's not working

  RTC_SetSecond(time,10);

    RTC_SetMinutes( time, 10);

     RTC_SetHours( time,10 );

the RTC as usal starts from the psoc internal RTC time

Please help me to resolve the issue.

please find the attachment

Thanks in advance

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

Hi,

I am working on Uart rx interrupt.I send the data through terminal,then my code receive the data and print on the console.

But my code problem is when i  send the data upto 15 bytes but reads upto 8 bytes only,if i change the buffer size in uart  receiver settings morethan 8 bytes than

the my code always executes the interrupt only ,i.e it is not coming out from interrupt.

so,please help me to resolve the issue.

Thanks in advance.

please find the attachment

0 Likes

Just calculate the required values for your application as

Input frequency / Prescaler / Period = TC frequency

1 / TC frequency = Time between TC

Bob

Anonymous
Not applicable

Thanks alot sir.......

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

i want to send the rtc time stamp to the mobile. And i able to send this.but the problem is while programming the chip the RTC takes the internal time

and it starts updating.But i want to set my own time not the psoc time i.e, my time is  10:10:10(H:M:S)

even if i use below API'S to set the time  it's not working

  RTC_SetSecond(time,10);

    RTC_SetMinutes( time, 10);

     RTC_SetHours( time,10 );

the RTC as usal starts from the psoc internal RTC time

Please help me to resolve the issue.

please find the attachment

Thanks in advance

Time_stamp.cywrk.Archive01.zip

0 Likes
Anonymous
Not applicable

Try debugging what time value uint32 time is set to in the set_rtc(void) function after calling the RTC_Set... inline functions.

If the RTC_set... functions are working correctly, then my guess is that you are not updating the BLE data from the internal RTC count when you read the data from your mobile device.

You need to update the GATT DB attributes containing the RTC value when you get a read request for the custom service that holds your RTC value. This is the function you would use to update the GATT DB with new values:

CYBLE_GATT_ERR_CODE_T CyBle_GattsWriteAttributeValue (CYBLE_GATT_HANDLE_VALUE_PAIR_T * handleValuePair,
uint16 offset,
CYBLE_CONN_HANDLE_T * connHandle,
uint8 flags
)
0 Likes
Anonymous
Not applicable

Hi ,

I want to get the timestamp  of the mobile  when i connected the ble to the mobile,then my ble has to get the mobile  timestamp.

Is it possible to get the Timestamp of the mobile when  ble connected to the  cypress App in mobile.

Please give some suggestion .

Thanks in advance.

0 Likes
Anonymous
Not applicable

You will need to have the CySmart App either write the timestamp to the peripheral when it connects, or have the peripheral read/access the mobile to get the timestamp using BLE access.

Try looking at this bluetooth service: Viewer | Bluetooth Technology Website

as an example.

What I suggest: have the cysmart app write the current timestamp to the peripheral device upon successful connection, and then write the peripheral to handle the timestamp write value.

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

Hi,

I am working on Uart rx interrupt.I send the data through terminal,then my code receive the data and print on the console.

But my code problem is when i  send the data upto 15 bytes but reads upto 8 bytes only,if i change the buffer size in uart  receiver settings morethan 8 bytes than

the my code always executes the interrupt only ,i.e it is not coming out from interrupt.

so,please help me to resolve the issue.

Thanks in advance.

please find the attachment

0 Likes
Anonymous
Not applicable

Hi ,

I want to get the timestamp  of the mobile  when i connected the ble to the mobile,then my ble has to get the mobile  timestamp.

Is it possible to get the Timestamp of the mobile when  ble connected to the  cypress App in mobile.

Please give some suggestion .

Thanks in advance.

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

Hi,

I am working on Uart rx interrupt.I send the data through terminal,then my code receive the data and print on the console.

But my code problem is when i  send the data upto 15 bytes but reads upto 8 bytes only,if i change the buffer size in uart  receiver settings morethan 8 bytes than

the my code always executes the interrupt only ,i.e it is not coming out from interrupt.

so,please help me to resolve the issue.

Thanks in advance.

please find the attachment

0 Likes
Anonymous
Not applicable

Hi ,

I want to get the timestamp  of the mobile  when i connected the ble to the mobile,then my ble has to get the mobile  timestamp.

Is it possible to get the Timestamp of the mobile when  ble connected to the  cypress App in mobile.

Please give some suggestion .

Thanks in advance.

0 Likes