Sample code to output the ECO to a GPIO for trimming capacitance values

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

cross mob
mike_austin
Level 1
Level 1
First like received First reply posted First question asked

Hi,

Does anyone have some sample code I can use to output the ECO on my custom board to one of the GPIO on my CY8C4128LQI-BL483?

I'm wanting to check the ECO frequency, to see if I need to trim the ECO capacitance values to get better accuracy on my ECO frequency

Cheers,

Mike

1 Solution
lock attach
Attachments are accessible only for community members.
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Mike,

Attached is a sample and SIMPLE project that outputs the ECO frequency directly to a GPIO pin.

Tip:  Never directly measure ECO pins connected to the crystal.   ANY probe capacitance will adversely effect the frequency and in some cases the stability of the oscillation.  It is always preferable to push the crystal output through a buffer or other frequency divider. 

Len_CONSULTRON_0-1636984535120.png

Any probe capacitance on the output of a buffered output will not affect the crystal frequency. 

Using a scope to directly measure the signals on the ECO pins are only useful to verify the crystal is oscillating.  This is a GO/NOGO test.

The project I attaches is VERY SIMPLE.  This project has no running code in main().  Everything is set up to run before entering main().

It sets up the ECO and routes it to Routed1 path.  Then I attach a GPIO pin to Routed1.  It's that simple.

Len_CONSULTRON_1-1636984974630.png

I don't have the CY8C4128LQI-BL483 to test this project but it is SO SIMPLE and obvious.

If you have any issues, let me know.

One additional note:

If you are using this in a commercial product, most crystal suppliers will "trim" your ECO design.  You give a 'final' PCB with your best guess at the trim caps to the crystal supplier of your target crystal.  Make sure there is FW working enabling the ECO 100% of the time.  They will use their equipment to measure and, if needed, suggest other trim values to obtain the target frequency and stability.

We do this in automotive to make sure the crystal keeps the target frequency with manufacturer tolerance and stability over the operational temperature range. 

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
5 Replies
Renate
Level 3
Level 3
25 replies posted 25 sign-ins 10 replies posted

Hi. I seemed to run into the same problem figuring out how to get the ECO clock out onto a GPIO pin. In the end I decided that I didn't have any equipment to deal accurately with 24 MHz anyway. So instead I kept the 24 MHz internal to the chip (module), fed it to a 16 bit counter and captured on a GPS PPS 1 Hz coming in on a GPIO. It's all covered here:

https://community.infineon.com/t5/PSoC-4/CYBLE-012011-ECO-cap-trim-disagrees-with-KBA/td-p/323688

It seems that BT BLE ECO trim doesn't get enough attention. It makes a big difference.

0 Likes
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

Please use a frequency counter for measuring ECO.

Thanks,

P Yugandhar.

0 Likes
Renate
Level 3
Level 3
25 replies posted 25 sign-ins 10 replies posted

The OP is asking for sample code to do just that.

The naive way I tried of connecting a clock source to an GPIO output pin in the schematic editor doesn't seem to work for me.

I get it, you want everyone to use a frequency counter but it doesn't look like anybody ever does. Moreover, in the other thread I was asking people to confirm my GPS/counter measurements with a frequency meter.

0 Likes
lock attach
Attachments are accessible only for community members.
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Mike,

Attached is a sample and SIMPLE project that outputs the ECO frequency directly to a GPIO pin.

Tip:  Never directly measure ECO pins connected to the crystal.   ANY probe capacitance will adversely effect the frequency and in some cases the stability of the oscillation.  It is always preferable to push the crystal output through a buffer or other frequency divider. 

Len_CONSULTRON_0-1636984535120.png

Any probe capacitance on the output of a buffered output will not affect the crystal frequency. 

Using a scope to directly measure the signals on the ECO pins are only useful to verify the crystal is oscillating.  This is a GO/NOGO test.

The project I attaches is VERY SIMPLE.  This project has no running code in main().  Everything is set up to run before entering main().

It sets up the ECO and routes it to Routed1 path.  Then I attach a GPIO pin to Routed1.  It's that simple.

Len_CONSULTRON_1-1636984974630.png

I don't have the CY8C4128LQI-BL483 to test this project but it is SO SIMPLE and obvious.

If you have any issues, let me know.

One additional note:

If you are using this in a commercial product, most crystal suppliers will "trim" your ECO design.  You give a 'final' PCB with your best guess at the trim caps to the crystal supplier of your target crystal.  Make sure there is FW working enabling the ECO 100% of the time.  They will use their equipment to measure and, if needed, suggest other trim values to obtain the target frequency and stability.

We do this in automotive to make sure the crystal keeps the target frequency with manufacturer tolerance and stability over the operational temperature range. 

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Renate
Level 3
Level 3
25 replies posted 25 sign-ins 10 replies posted

Thank you for the explanation.

That part that I didn't find SO SIMPLE (or obvious) is that you can't connect HFCLK (24 MHz) to a GPIO but you can connect a Routed1 (24 MHz). OTOH, you can't connect Routed1 (24 MHz) to the clock on a counter.

0 Likes