Wavecom WMP100 - Using TCU Service (Open AT OS) - Need help

Hi all

Does anybody programming in OpenAt OS? [OS for Wavecom (Sierra Wireless) microprocesors]

I need help…:
I want to use TCU Service to make accurate timer (us - microseconds). I’ve tried example from documentation but it doesn’t work. In IRQ handler function I wrote adl_atResponse and TRACE functions but nothing isn’t displayed in terminal and also in traces view in Sierra Wireless Development Studio.
Maybe I am calling function with adl_irqSubscribe and adl_tcuSubcribe wrong. I simply called it in adl_main function. Is that ok?

This is code of my program:

#include "adl_global.h"
#include "adl_irq.h"
#include "adl_tcu.h"

const u16 wm_apmCustomStackSize = 1024 * 3;
s32 TCUHandle;
s32 IRQHandle;
adl_tcuTimerSettings_t Config;
adl_tcuTimerDuration_t timerDurationConfig;

bool MyTCUHandler (adl_irqID_e Source, adl_irqNotificationLevel_e NotoficationLevel, adl_irqEventData_t * Data) {
	if (Source == ADL_IRQ_ID_TIMER) {
		TRACE (( 1, "Timer event"));
		adl_atSendResponse(ADL_AT_UNS, "Timer Event");
	return TRUE;

void myFunction1(void) {
	timerDurationConfig.DurationUnit = ADL_TCU_TIMER_UNIT_MS;
	timerDurationConfig.DurationValue = 5;
	Config.Duration = timerDurationConfig;
	Config.Periodic = TRUE;

	adl_irqCapabilities_t Caps;
	adl_irqConfig_t IrqConfig;

	//Set configuration
	IrqConfig.PriorityLevel = Caps.PriorityLevelsCount-1;
	IrqConfig.Enable = TRUE;
	IrqConfig.Options = ADL_IRQ_OPTION_AUTO_READ;

	IRQHandle = adl_irqSubscribeExt(MyTCUHandler, ADL_IRQ_NOTIFY_LOW_LEVEL, &IrqConfig);
	TCUHandle = adl_tcuSubscribe(ADL_TCU_ACCURATE_TIMER, IRQHandle, 0, &Config, NULL);

void myFunction2() {
	ascii tekst[30] = { 0 };
	adl_tcuTimerDuration_t RemainingTimer;
	adl_tcuStop(TCUHandle, &RemainingTimer);
	wm_sprintf(tekst, "\r\n Remaining time: %d\r\n",
				adl_atSendResponse(ADL_AT_UNS, tekst);

void adl_main(adl_InitType_e InitType) {
	TRACE (( 1, "Embedded Application : Main" ));

Thanks for anything help.

PS: If topic isn’t in good place please move it.


I added stack definition for IRQ and with ms (miliseconds) it is probably working (maybe not correctly but I see traces), but mith another ADL_TCU_TIMER_UNIT (_S and _US) isn’t working.
Any suggests why?

Well, that is the topic of this forum, isn’t it?!

Are you familiar with embedded programming - in particular, with programming interrupt handlers?

As a general rule, interrupt handlers - including IRQ handlers in Open-AT - need to be kept as short & simple as possible.
Therefore, you need to be very careful about use of things like adl_atResponse and TRACE…

(is adl_atResponse even allowed from an IRQ handler?)

Are you sure you have enabled the correct Trace levels?
Note that traces from IRQ handlers are on separate levels from the “main” ADL traces…

Have you looked at the supplied examples?

Have you spoken to your Distributor or FAE for support?

Hello again

First of all thank you for your reply

According to my first question…It was stupid but I copied all from other forum when I wrote firstly. So sorry…

Like I wrote when I added call stack declaration for IRQ I see traces. But only when I am using ADL_TCU_TIMER_UNIT_MS. For mikroseconds it doesn’t work and I don’t know why.

TCUHandle = adl_tcuSubscribe(ADL_TCU_ACCURATE_TIMER, IRQHandle, 0, &Config, NULL);
	TRACE( ( 2, "Subscribe to TCU: %d", TCUHandle ) );

return “Subscribe to TCU: -2

I am on student practice and programming WMP100 is my task. Enterprise gave me device and I have to programm it, so I can’t please distributor for any support because I don’t know him.

I you could, please help me. I’ll be very appreciate.

As far as I know, the minimum timing permissible is 1mS and the longest is 655mS. The TCU service used to be able to go down to 250us in Firmware version 7.1, however this was changed (not sure when). Here is a detailed description of why it was changed:

What you can do is read the hardware registry to find the actual limits. See the code below:

s32 size = adl_regGetHWData("tcu_TimerBoundaries", NULL);
      adl_tcuTimerBoundaries_t * Timer_boundry = adl_memGet(size);
      size = adl_regGetHWData("tcu_TimerBoundaries", Timer_boundry);
      TRACE((1, "Timer Durations: Max Val-%d, Max U-%d", Timer_boundry->MaxDuration.DurationValue, Timer_boundry->MaxDuration.DurationUnit));
      size = adl_regGetHWData("tcu_TimerTick", NULL);
      adl_tcuTimerDuration_t * Timer_duration = adl_memGet(size);
      size = adl_regGetHWData("tcu_TimerTick", Timer_duration);
      TRACE((1, "Timer Resolution: %d, %d", Timer_duration->DurationValue, Timer_duration->DurationUnit));

We use an extern PIC micro for any fast measurements or IO.

What exactly are you trying to do? There may be another way :slight_smile:


I need to connect iButton (DS1990A) and read its unique identifier. So I need to implement 1-wire communication.
Device that iButton will be cooperative is ready and its work is managed by WMP100 so I have to use WMP100.
Any ideas how to do my task?

Thanks for the your help

Edit: I’ve read a few of topics about 1-wire communication implemented by using Open At and something tell me that it isn’t possible :/. But no one has used WMP100, for example Q2686, but it works with the same ARM946. But I need to be sure. Please give me the simple answer YES/NO : Can I implement 1-wire using Open At and WMP100?

If NO could you told me exactly why? For example…because I can’t use any timers which can produce so fast ticks?

In my case time of setting direction IO isn’t important, because I will use one pin for input and one for output. iButton will not be connect directly to WMP100.

OK, I’ve checked what code provide by @tomridl results and as @tomridl said the minimum time duration for TCU service is 1 ms. Thank you very much @tomridl.

Ok, so I can’t use any timers, but maybe is other way? So the question is still actually.

You cannot implement 1-Wire by directly bit-banging a GPIO pin using Open-AT.

You have already been told why: you don’t have access to timers with the necessary resolution.

Maxim make bridge chips to control a 1-Wire bus from I2C or a UART…

OK, but what in case when I will use loops to generate right delays?
I know that this isn’t answer for this problem, but I can’t do it in other way (can’t use I2C :frowning: ).
What is a probability that watchdog reset device when maximum delay function will be around 500 us? (I can’t find description of watchdog so I don’t know how it works, could you provide me some papers or short description?)
It will be short time loops so i think watchdog won’t run. So should look “for” loop which will delay around 1 us? I don’t know how to calculate it.

I will be very apreciate for every help.

  1. You can’t ever create accurate, guaranteed timing with HLL ‘for’ loops:

  2. Even if you could, the timing of the ADL GPIO calls is not tight enough - it would be like trying to do bit-banging in VisualBasic on a Windows PC!!

Ok, I can write delay function in asm and inject it in C code.

I am little importunate but I need concrete answers to convince my supervisor (I am on student practice now) that I can’t do it that way how he want. So please could you told me how long take setting pins?

I wouldn’t rely on that - I certainly wouldn’t rely on it being easy in Open-AT!

You will need to budget some time to try it and see.

You could just call your distributor or FAE, and have them give you a concrete answer.

The point is, it is not specified - certainly not to the precision required for reliable 1-Wire operation.

Again, you will need to budget some time to try it and see.

Ok, thanks.
Tomorrow I will have hard conversation I think…

Such is life in the Real World…!

Hello all,

I’ve told with my supervisor and explain him everything, but it goes me to bigger problem.
He’s contacted with other poeople doing smething with device that I am using and provide me couple of solutions, but the most important is:

Device has also PIC (PIC16F88) which is using to manage power supplying (that they said…). PIC is connected with WMP100. What I have to check is if it is possible to generate right time slots by PIC and next with using interuption setting right value on WMP100 I/O. So the case looks that:
PIC is connected with WMP100 by INT3 pin.
PIC generate time slots - PIC count to right value of us, next set INT3 pin what is recognized by WMP100, which set right value on I/O (in interuption function) which is connected with iButton.

My questions are: Could it will work? To work with interuption need I use which service from Open AT?

Very thanks for earlier responses and please for further help

If you have an external microcontroller, that would be a good approach.

You need to study the ADL User Guide for details of available services…

Check the WMP100 documention - I think the INT pin(s) can also be used as “normal” GPIO…?

Also look at the supplied examples…

I can’t use this PIC to do all 1-wire communication. I want to know if it is possible to do it by that I explained upper - by using PIC only for generate right time durations and generate interuption for WMP100?
iBuuton will be then connect to WMP100 I/O pins.

No - you would have to connect the iButton to the PIC pin(s).

It’s the timing to the iButton that is critical. Open-AT cannot do this timing, so there’s no use connecting the iButton to a WMP pin!

OK, so you are saying that seetings pin value by OpenAt (adl_ioWriteSingle) can take too much time, right?
Because I don’t understand what you mean by “timing”. Right points in time line when value of pin connected to iButton (1-wire bus) should change its state will be generated by interuption which will be sent from PIC. PIC count right time duration and next send signal to interrupt WMP100 normal work.
Interruption on WMP100 are operated immediately, when interruption signal occurs, aren’t they?

You seem to have lost track of what’s already been discussed!

Go back and review the entire thread - it may help if you print it out, so that you can see everything at once…

Sorry, maybe a litle…
I remember your words:

but I really can’t believe that so simple operation like setting pin can take time more than 5 us (I think with 1-wire communication 1-write time slot is the most demanding where master has to release bus in 15 us) on WMP100 which working with ARM9 :confused:

Problem for me is in that my supervisor wants information like from documentation. Your words for me are enough, but won’t be for him :confused:
That’s why I am so importunate, sorry.