How to send simple serial data in chunks?

I checked the reference added in an old post but did not understand can you please clarify more what I need to do from the host side and in the c code(target)?

Thanks

You need to make code that can write into different parts of your array with subsequent commands. One way you might do this is via the scmd field of the simpleserial V2 packet. For example, you could have each packet send 200 bytes of data, with the command transferring bytes 0-199 if scmd=0, bytes 200-399 if scmd=1, bytes 400-599 if scmd=2 and so on.

Is there any example on its usage in the chipwhisperer library?

No there isn’t, sorry, but you can see something similar achieved by using multiple commands to send back a larger buffer than simpleserial V1 allows: https://github.com/newaetech/chipwhisperer/blob/develop/hardware/victims/firmware/simpleserial-rsa/simpleserial-rsa-arm.c#L375

Thank you for this example. I understood from that you are trying to send back a large buffer, but in my case I want to do the opposite. I want to send from the host initially larger data than allowed, but I am unable to know how I can do this in python and accept it in the c code (firmware) without errors.

I tried sending it this way in python

            configuration_data.target.simpleserial_write(
                'g', bytearray([0, 0, 0, 0]))
            configuration_data.target.simpleserial_write(
                'h', bytearray([1, 1, 1, 1]))

Receive it this way in c

 simpleserial_addcmd('g', 4, glitch_loop);
  simpleserial_addcmd('h', 4, glitch_loop);

but it is not terminating I am not receiving any response from the board

Also I tried the scmd

           configuration_data.target.simpleserial_write(
               0x00, 0x01, float_array)

but I got this error:

File “/lib/python3.10/site-packages/chipwhisperer/capture/targets/SimpleSerial2.py”, line 596, in send_cmd
buf = [0x00, cmd, scmd, len(data)]
TypeError: object of type ‘int’ has no len()

Can you please check these options because I am stuck in this for a while? Thanks

Do these commands both work when sending them individually?

Yes it works when I send it individually

In that case, I recommend putting simpleserial_wait_ack() between the simpleserial_writes() you do.

When I did that I got ERROR:ChipWhispererGlitch:Received invalid data. Also I do not understand how in the C files I can wait till I get all the data then start the function called by the add cmd method.