ActivateTriggerIn() via C++


#1

Hi,

I’m having a problem with the activation of TriggerIn endpoints using C++.
I try it like this:

if (0 == dev->ActivateTriggerIn(0x40, **0x02**)){
           std::cout<<"(Triggering ... )"<<std::endl;
} else {
            std::cout<<"(ERR)"<<std::endl;
}

The VHDL part looks like this:

ep40 : okTriggerIn
port map (okHE => okHE, ep_addr => x"40", ep_clk => CLK_100, ep_trigger => ep40trig);

Trigger_T <= ep40trig(0);
Trigger_R <= ep40trig(1);

I’m not sure how to use the second parameter of ActiveTriggerIn, I tried different numbers, but none of them seem work. I’m trying to use the 2nd bit of this TriggerIn.

It worked when I used a XML interface with a trigger button (I used separate TriggerIns for every trigger though). Also, reading TriggerOut (UpdateTriggerOuts() and IsTriggered()) and setting and reading Wires works.

So I thinkt that either I’m using the ActivateTriggerIn()-command in a wrong way or it might be something wrong with the VHDL implementation.

Thanks in advance.


#2

ok … I did some tests and looped over different values.
Apparently it works when using a UINT32 type for ActivateTriggerIn(addr, bit) starting at 0 for the first bit and so on.
But IsTriggered() requires a mask, which is a bit confusing.


#3

They are two separate methods and have different parameters because they function differently.

Is there something confusing or contradictory about the documentation? From the API documentation, there is consistent use of the term “mask” and it references “bit or bits” and even includes an example that should be pretty clear. Similarly, the ActivateTriggerIn documentation references a bit and does not refer to a mask.


#4

I was a bit confused by the bit parameter, because most other functions use a mask parameter and when I tried to use ActivateTriggerIn() the first time it didn’t work regardless of what I used as a parameter.

I’m using the documentation of 4.5.0 which is available on the website (the linux installation (4.5.5) does not provide the documentation). In the documentation for 4.5.0, there is no example for ActivateTriggerIn(). Maybe it would help to add that the bit parameter stars counting at 0 (it’s logical but different from mask).


#5

The DESTester, RAMTester, and PipeTest samples all use ActivateTriggerIn.