WARNING:root:Timeout in OpenADC

Dear All,
I want to capture traces of a function GS().
I am using CWLITEARM and STM32F4 target.

My paython code is as follow:

key = os.urandom(SIZE)
text = os.urandom(SIZE)

traces =

#output = target.simpleserial_read(‘r’, 256, timeout=100000)

target.simpleserial_write(‘k’, key)
target.simpleserial_wait_ack(timeout=50000)
scope.arm()

target.simpleserial_write(‘p’, text)
ret = scope.capture()
traces.append(scope.get_last_trace())
output = target.simpleserial_read(‘r’, SIZE, timeout=50000)

print(output)

I have the error

WARNING:root:Timeout in OpenADC capture(), trigger FORCED
WARNING:root:Timeout in OpenADC capture(), trigger FORCED

I tried to augment the baudrate to 11500, and add time.sleep(0.000001) to read and write functions in the serial.py file but this was not useful.

The GS code was compiled and executed on my machine which means the code itself does not have issues.
GS() contains functions inside it, I run every function alone and got the traces, however when I call GS it seems like the chip needs more time to execute the “heavy code”. But as I said, augmenting the timeout did not help me solve it.

Any suggestions?

Thank you,
Sou

There are two options:

  • the trigger happens before you capture, try to add a simple for loop before trigger_high in target firmware to little delay it
  • the trigger happens after you capture, try to measure with logic analyzer if and when trigger happens

3

Thank you very much for the reply, I tried the first option and I still have different error

WARNING:root:Unexpected start to command:

my victim code is this:

uint8_t get_pt(uint8_t * pt) {

/**********************************

  • Start user-specific code here. */

int64_t sample[1024];

uint8_t s[16] = {‘k’,‘l’,‘w’,‘w’,‘k’,‘l’,‘z’,‘w’,‘k’,‘e’,‘q’,‘e’,‘k’,‘l’,‘r’,‘w’};

trigger_high();

randomness_set_seed(s);
for(int i=0; i<1024; i++) sample[i] = 0;
GS(sample,1024);
trigger_low();

/* End user-specific code here. *
********************************/

simpleserial_put(‘r’, TEXT_LENGTH_BYTES, (uint8_t * ) sample);

return 0x00;
}
Can you explain more the second step? I am not experienced in cw prog. please…

Thanks

I just want to confirm: you get only “WARNING:root:Timeout in OpenADC capture(), trigger FORCED” and no traces? Because sometimes such warning happens to me too, but I just ignore it. It occurs more often depending on the platform, some platforms are without them, and some are full of such warnings.

Do you have any tools available to you that you can confirm the trigger is visible on the bus? For example logic analyzer. With logic analyzer you can connect to the pins and inspect traces there.

Hello,
Thank you for the reply.
I used an UART converter. and I made sure that the key and text are sent to the target , but I cannot see any output.
the target is not outputing anything. Could this be due to the high memory consumption of the algorithm?
The algorithm does not have bugs beause I tested it on host and it delivers correct output.
Best,
Sou

I would start with check if CPU is powered. What’s your target board? How do you power it?
Is it properly reset? (sometimes a reset is required if you are not programming it)
Next, is it programmed?

etc :slight_smile:

Hello,
Thank you for the reply.
I am actually sorry for the wrong conclusion. What I did is the following:
I connected the RX wire of my UART converter to the TX pin of the target and I was able to detect an output. when I compared the output to the output I have when I run the same program on my laptop, it matches.
but on the jupyter code I have the same error always even after trying to run this multiple times.

WARNING:root:Unexpected start to command:

here I write you my pt function and jupyter code:

uint8_t get_pt(uint8_t * pt) {

/**********************************

  • Start user-specific code here. */
    int samplesnumber = 256;
    int64_t sample[samplesnumber];
    uint8_t res[KEY_LENGTH]; //32
    uint8_t k[KEY_LENGTH]; //32

for(int i=0;i<KEY_LENGTH;i++)
{
k[i] = key[i];
res[i] = 0;
}
for(int i=0;i<samplesnumber;i++)
{
sample[i] = 0;

}

trigger_high();
uint8_t s[16] = {1,14,2,15,1,8,1,1,9,1,1,1,2,1,1,1};
randomness_set_seed(s);

gaussian_sampler(sample,samplesnumber);
trigger_low();

for(int i=0;i<KEY_LENGTH;i++)
{

  res[i] = (uint8_t)sample[i];

}
/* End user-specific code here. *
******************************/
//simpleserial_put(‘r’, 2
(TEXT_LENGTH+KEY_LENGTH), (uint8_t
)ret);

simpleserial_put(‘r’, TEXT_LENGTH_BYTES, (uint8_t * ) res);

return 0x00;
}

jupyter block :

import os
SIZE = 32

#SIZE = 63 # Working

#SIZE = 128 # also Working

#SIZE = 256 # also Working

#SIZE = 1024 # also Working

#SIZE = 2048 # also working

#SIZE = 2050 # that’s too much (z03)

keyint = [1,14,2,15,1,8,1,1,9,1,1,1,2,1,1,1]
key = int16_to_bytes(keyint)

#key = os.urandom(SIZE)
text = os.urandom(SIZE)

traces =

#output = target.simpleserial_read(‘r’, 256, timeout=100000)

target.simpleserial_write(‘k’, key)
target.simpleserial_wait_ack(timeout=5000)
scope.arm()

target.simpleserial_write(‘p’, text)
ret = scope.capture()
traces.append(scope.get_last_trace())
output = target.simpleserial_read(‘r’, SIZE, timeout=5000)

print(output)

Best and thank you!

whoops replied to the wrong comment.

Hi Sou,

Sorry super busy this week on our end.

There’s a pretty small buffer on the CW (IIRC 128 bytes), so long messages don’t work well for both read and write. To confirm, do your comments mean that the whole thing functions with SIZE up to 2048 bytes?

Alex