Post Go back to editing

Connecting Arduino MKR ZERO with EmStat Pico (without Development board)

Hi

I have both a standalone EmStat Pico Module and a Pico EmStat Development board and a Arduino MKR ZERO microcontroller.

When I run our latest example code from Github: link using the development board I get consistent readings out:

13:09:26.978 -> Connected to EmStat Pico
13:09:26.978 -> 
13:09:26.978 -> Response begin
13:09:27.990 -> 
13:09:27.990 -> Measuring...
13:09:28.499 -> 
13:09:28.499 -> Receiving measurement response:
13:09:28.499 -> 1	E set[V]: -4.999E-01	I[A]: -4.990E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:29.011 -> 2	E set[V]: -4.497E-01	I[A]: -4.491E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:29.484 -> 3	E set[V]: -3.995E-01	I[A]: -3.987E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:29.997 -> 4	E set[V]: -3.493E-01	I[A]: -3.483E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:30.502 -> 5	E set[V]: -2.992E-01	I[A]: -2.985E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:31.015 -> 6	E set[V]: -2.490E-01	I[A]: -2.481E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:31.497 -> 7	E set[V]: -1.988E-01	I[A]: -1.977E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:32.006 -> 8	E set[V]: -1.486E-01	I[A]: -1.478E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:32.516 -> 9	E set[V]: -9.840E-02	I[A]: -9.744E-06	status: Underload        	CR: 1 mA (High speed)    	
13:09:32.996 -> 10	E set[V]: -4.821E-02	I[A]: -4.704E-06	status: Underload        	CR: 1 mA (High speed)    	
13:09:33.524 -> 11	E set[V]: 1.976E-03	I[A]: 2.240E-07	status: Underload        	CR: 1 mA (High speed)    	
13:09:34.011 -> 12	E set[V]: 5.216E-02	I[A]: 5.264E-06	status: Underload        	CR: 1 mA (High speed)    	
13:09:34.515 -> 13	E set[V]: 1.024E-01	I[A]: 1.030E-05	status: Underload        	CR: 1 mA (High speed)    	
13:09:35.029 -> 14	E set[V]: 1.525E-01	I[A]: 1.529E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:35.505 -> 15	E set[V]: 2.027E-01	I[A]: 2.033E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:36.011 -> 16	E set[V]: 2.529E-01	I[A]: 2.531E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:36.516 -> 17	E set[V]: 3.031E-01	I[A]: 3.035E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:37.023 -> 18	E set[V]: 3.533E-01	I[A]: 3.534E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:37.543 -> 19	E set[V]: 4.035E-01	I[A]: 4.043E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:38.013 -> 20	E set[V]: 4.537E-01	I[A]: 4.542E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:38.515 -> 21	E set[V]: 5.039E-01	I[A]: 5.040E-05	status: OK               	CR: 1 mA (High speed)    	
13:09:38.515 -> 
13:09:38.515 -> Measurement completed.
13:09:38.515 -> 21 data point(s) received.

However, when I run the same code and connect the standalone EmStat Pico to the Arduino MKR ZERO like this: image, I get this error output:

13:39:46.037 -> Connected to EmStat Pico
13:39:46.037 -> 
13:39:46.037 -> Failed to parse package: -5

which is not documented in the EmStat Pico communication protocol V1.2.

Can you please help me debug this issue, as I would like to understand and work with the protocol.

  • Hi kasparjj,

    The error "Failed to parse package: -5" is an error from the example library, it does not necessarily relate to an error code from the EmStat Pico protocol.

    There should not be a difference between an EmStat Pico module and the Dev Board. So we are probably looking at another difference between the two setups. It also seems capable of connecting to the Pico, so we can assume there is some level of communication.

    Have you checked that both the EmStat Pico module and DevBoard are using the same firmware version? The latest example code is intended for firmware v1.3. There is still a 1.2 release available on GitHub if needed.

    If that's not it, I would recommend looking at the unparsed communication to see what is going on. This can be done in example by settings the following booleans to true:
    static bool s_printSent = true;
    static
    bool s_printReceived = true;

    Kind regards,
    Hielke