Issue of TCU



I am trying to use the TCU to count the number of pulses generated by an AC sonsor.
I use the example code:Event Capture Service Without Event Generationwithout any modification.

From the traces, there is no event captured, so is this correct that i connect the signal generated from the sensor to the pin1 of GPIO21 of FXT009.

Thank you very much.


Is the signal from this mystery “sensor” compatible with an FXT GPIO :question:


The sensor is a digital transducer, it’s output is RS-485


That’ll be a NO, then!

RS485 uses differential, bipolar signals - not compatible with an FXT GPIO :exclamation:

Event Capture Service Without Event Generation
#include "adl_global.h"
#include "adl_tcu.h"
const u16 wm_apmCustomStackSize = 4096;
// Global variables
//Cyclic Timer pointer
adl_tmr_t *timer_ptr;
//Cyclic timer period
u16 timeout_period = 5;
// TCU service handle
s32 TCUHandle;
// Event counter to be provided to the API
u32 EventCounter;
// TCU Event capture configuration: on pin 0, count falling edges, with a provided event counter
adl_tcuEventCaptureSettings_t Config = { 1, ADL_TCU_EVENT_TYPE_FALLING_EDGE,0, &EventCounter };
void Timer_Handler (u8 Id, void* Context)
// Periodically monitor the events counter
TRACE (( 1, "Current events count: %d", EventCounter ));
void adl_main (adl_InitType_e adlInitType)
// Subscribes to the TCU service, in Accurate Timer mode
TCUHandle = adl_tcuSubscribe ( ADL_TCU_EVENT_CAPTURE, 0, 0, &Config, NULL );
// Reset counter to 0, and starts event generation
EventCounter = 0;
// A cyclic timer is subscribed.
timer_ptr = (adl_tmr_t*) adl_tmrSubscribe (TRUE, timeout_period,
ADL_TMR_TYPE_100MS, (adl_tmrHandler_t) Timer_Handler);
adl_tcuStart ( TCUHandle );

So right now, I use the commands AT+WIOM=1,“GPIO25”,0 and AT+WIOW=“GPIO25”,0 to set the GPIO25 of FXT009 as input of low.
And the commands AT+WIOM=1,“GPIO21”,1 and AT+WIOW=“GPIO21”,1 to set the GPIO21as output of high.

Then use the wire to connect then break then connect then break the GPIO25 and GPIO21… to generate the events.
But without any luck, the trace shows there is no events.

So i want to ask am i using the code Event Capture Service Without Event Generation correctly because i change nothing of the sample code.
or the way i generate the events has problem?

And i want to thank you so much for your patience and help.