Skip to content

Commit

Permalink
* fix config mclk bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed Dec 31, 2024
1 parent 6dbf1fa commit 92178c4
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions components/vision/port/maixcam/maix_camera_mmf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,22 @@ namespace maix::camera
peripheral::i2c::I2C i2c_obj(4, peripheral::i2c::Mode::MASTER);

_retry:
if (retry_count < 1) {
int mclk_id = _get_mclk_id();
if (mclk_id == 0) {
system("devmem 0x0300116C 32 0x5"); // MIPI RX 4N PINMUX MCLK0
system("devmem 0x0300118C 32 0x3"); // MIPI RX 0N PINMUX MIPI RX 0N
} else if (mclk_id == 1) {
system("devmem 0x0300116C 32 0x3"); // MIPI RX 4N PINMUX MIPI RX 4N
system("devmem 0x0300118C 32 0x5"); // MIPI RX 0N PINMUX MCLK1
} else {
system("devmem 0x0300116C 32 0x3"); // MIPI RX 4N PINMUX MIPI RX 4N
system("devmem 0x0300118C 32 0x3"); // MIPI RX 0N PINMUX MCLK1
}
retry_count ++;
goto _retry;
}

std::vector<int> addr_list = i2c_obj.scan();
for (size_t i = 0; i < addr_list.size(); i++) {
// log::info("i2c4 addr: 0x%02x", addr_list[i]);
Expand Down Expand Up @@ -317,19 +333,6 @@ namespace maix::camera
}
}

if (retry_count < 1) {
int mclk_id = _get_mclk_id();
if (mclk_id == 0) {
system("devmem 0x0300116C 32 0x5"); // MIPI RX 4N PINMUX MCLK0
system("devmem 0x0300118C 32 0x3"); // MIPI RX 0N PINMUX MIPI RX 0N
} else {
system("devmem 0x0300116C 32 0x3"); // MIPI RX 4N PINMUX MIPI RX 4N
system("devmem 0x0300118C 32 0x5"); // MIPI RX 0N PINMUX MCLK1
}
retry_count ++;
goto _retry;
}

// log::info("sensor address not found , use gcore_gc4653\n" );
snprintf(name, sizeof(name), "gcore_gc4653");
return {false, name};
Expand Down

0 comments on commit 92178c4

Please sign in to comment.