Check the chips on the board
Read every expected chip's ID register and report missing or wrong parts. An easy embedded C problem (Board bring-up, step by step), run and graded in the…
easy · Board bring-up, step by step · bring-up · i2c · self-test
Part of a power-on self-test: check that every chip the board should have is there and is the right part. Write post_check(parts, n), which for each part, in order, reads its ID register and prints one line:
<name>: okif the ID matches,<name>: no answerif the read fails,<name>: wrong id 0xXX, expected 0xYYif a different ID comes back (two uppercase hex digits each),
and returns the number of parts that failed.
Starter code
int post_check(const part_t *parts, int n) {
for (int i = 0; i < n; i++) printf("%s: ok\n", parts[i].name);
return 0;
}Example tests
A good board
fit(0x76, 0xD0, 0x60);
fit(0x18, 0x0F, 0x33);
fit(0x68, 0x75, 0x68);
printf("%d failed\n", post_check(BOARD, 3));Expected output:
BME280: ok
LIS3DH: ok
MPU-6050: ok
0 failedLearn it first
- Board bring-up, step by step · From first probe connection to clocks, console, memory tests and a power-on self-test.
More Board bring-up, step by step problems
- Start the crystal, or fall back · Switch to an external crystal with a timeout, fall back to the internal oscillator, and set the baud rate for whichever clock you got.
- Test the data and address buses · Find stuck data lines and stuck or shorted address lines in external RAM.