Closed ambyc-fy closed 2 years ago
First I run sps30_probe(). At some points it fails once but then it successfully probs.
It may be a timing issue. Could you try to wait a few 100ms before probing the first time?
The problem now comes on ret = sps30_read_measurement. To start with i get ret = -2 then next loop iteration i get ret = 0.
-2
is SENSIRION_SHDLC_ERR_MISSING_START
according to sensirion_shdlc.h. So maybe your UART implementation misses the first byte? Or it has a timeout before the first byte arrives?
I close this issue, since there was no communication for a long time.
Hi I am struggling to get the sensor work with the Atmel Sam4s. I have verified UART comms works on a serial monitor and now connected the SPS30. I have also verified the serial communication is some how working because when i mess up the serial configuration the sensor
int16_t sps30_probe(void);
does not run.Here are my observations.
First I run
sps30_probe()
. At some points it fails once but then it successfully probs.I then set
sps30_set_fan_auto_cleaning_interval_days
which does not return an error and that is ok.I then set
sps30_start_measurement
. Which reads ok. At this point I can hear the fan from the sensor.The problem now comes on
ret = sps30_read_measurement
. To start with i getret = -2
then next loop iteration i getret = 0
.Can anyone help me please? Firstly to explain what is actually going on and secondly what i am doing wrong.
I am using the ASF library in Atmel Studio. The API is very easy to understand here http://asf.atmel.com/docs/latest/sam4c/html/group__buart__plc__group.html
Here is my main loop
Here is my UART implementation.