RuiqiLi
January 22, 2025, 11:55pm
1
Greetings,
Has anyone ever see this before while using terminal connect devkit?
"ERR Failed to sample pressure sensor!ERR Failed to sample pressure sensor!power | tick: 8004205, rtc: 0, addr: 67, voltage: 0.001600, current: 0.000000
power | tick: 8004207, rtc: 0, addr: 65, voltage: 24.011200, current: -0.000500
packet processing error: -7
packet processing error: -7
"
Our group is working on apply RP2040 microcontroller and circuit python to the Dev kit. We finished everything on the Circuiy Python Guide and everything work last month. While I am trying to connect a DS18B20 temperature, we have those error codes. We checked the circuit, and we have these error codes with or without our temperature sensor and RP2040 microcontroller.
Hi!
These two errors come from two different places in the code.
The dev kit breakout board has a BME280 pressure sensor on the I2C bus. When we try and fail to read it, we print an error here:
uptimeGetMs(), rtcTimeBuffer, _pressureData.temperature, _pressureData.pressure);
spotter_log_console(0, "pressure | tick: %llu, rtc: %s, temp: %f, pressure: %f", uptimeGetMs(),
rtcTimeBuffer, _pressureData.temperature, _pressureData.pressure);
taskENTER_CRITICAL();
_latestPressure = pressure;
_latestTemperature = temperature;
_newPressureDataAvailable = true;
taskEXIT_CRITICAL();
} else {
printf("ERR Failed to sample pressure sensor!");
}
return success;
}
/*
sensorSampler function to initialize the barometer
\return true if successful false otherwise
*/
static bool baroInit() {
You’d need to look at the hardware to understand why it’s failing to read.
The “packet processing error” comes from the serial_bridge
app that you’re using to talk to the RP2040. It’s printed here:
printf("buffer full, resetting\n");
reset();
} else {
if (b == 0) {
cobs_decode_result result =
cobs_decode(packet_buffer, packet_buf_size, rx_buffer, rx_idx - 1);
if (result.status == COBS_DECODE_OK) {
bm_serial_packet_t *packet = reinterpret_cast<bm_serial_packet_t *>(packet_buffer);
bm_serial_error_e err = bm_serial_process_packet(packet, result.out_len);
if (err != BM_SERIAL_OK) {
printf("packet processing error: %d\n", err);
}
} else {
printf("cobs decode error: %d\n", result.status);
}
reset();
}
}
}
}
It prints that when the message received from the RP2040 has valid COBS encoding but an error in processing the packet. The error codes are here:
} bm_serial_callbacks_t;
typedef enum {
BM_SERIAL_OK = 0,
BM_SERIAL_NULL_BUFF = -1,
BM_SERIAL_OVERFLOW = -2,
BM_SERIAL_MISSING_CALLBACK = -3,
BM_SERIAL_OUT_OF_MEMORY = -4,
BM_SERIAL_TX_ERR = -5,
BM_SERIAL_CRC_ERR = -6,
BM_SERIAL_UNSUPPORTED_MSG = -7,
BM_SERIAL_INVALID_TOPIC_LEN = -8,
BM_SERIAL_INVALID_MSG_LEN = -9,
BM_SERIAL_MISC_ERR = -10,
} bm_serial_error_e;
void bm_serial_set_callbacks(bm_serial_callbacks_t *callbacks);
bm_serial_error_e bm_serial_process_packet(bm_serial_packet_t *packet, size_t len);
bm_serial_error_e bm_serial_tx(bm_serial_message_t type, const uint8_t *buff, size_t len);
bm_serial_error_e bm_serial_pub(uint64_t node_id, const char *topic, uint16_t topic_len,
Code -7 is “unsupported message”, returned when the packet’s type
field was not one of the known values here:
Probably you’re not sending valid bm_serial
data from the RP2040. The python library for sending a couple of known publish messages is here:
import board
import busio
class BristlemouthSerial:
def __init__(self, uart=None, node_id: int = 0xC0FFEEEEF0CACC1A) -> None:
self.node_id = node_id
if uart is None:
self.uart = busio.UART(board.TX, board.RX, baudrate=115200)
else:
self.uart = uart
def spotter_tx(self, data: bytes) -> int | None:
topic = b"spotter/transmit-data"
packet = (
self.get_pub_header()
+ len(topic).to_bytes(2, "little")
+ topic
+ b"\x01"
This file has been truncated. show original
Does that help?
RuiqiLi
January 23, 2025, 10:23pm
3
Thankyou!
I will try solve those errors
Hi @zachary , I’m trying to help @RuiqiLi through the devkit. If we do determine that there is a hardware issue with the BME280, is there a new firmware image for the devkit that you can provide him to completely bypass the sensor?
zachary
January 24, 2025, 11:45pm
5
Hey Aadu!
OK first a question about which version of the Bristlefin we’re working with — an older one has a big, white, round, MS5803 while newer ones use the BME280. Here’s a side-by-side pic.
And then another question about the logs. If the barometer is having an issue, I would expect to see “Failed to init bristlefin” on the USB console of the mote, printed here:
If that is happening, then I would recommend commenting out those 3 lines. That will remove any setup of the HTU or pressure sensors.
Make sense?