KurtE
Senior Member+
Soon I will be out again doing more yard/garden work...
But thought I would mention that I wanted to get all of the cameras to work on T4.1 on the CSI pins, that worked on the Micromod with
FlexIO. The main problem child is the Arducam HM01b0 sold by Arduino as well as Arducam. The main issue with this camera was
for some reason Arducam decided to not connect up D4-D7 pins, so this camera only works in 4 bit mode.
Problem is, CSI does not support 4-bit mode. But as mentioned a few messages up, the CSI pins are also FlexIO3 pins, so... I decided to see
if I could make it work! The answer is mostly...
But, it took a few attempts with missteps... Sort of along the lines:
a) It detected that CSI would not work...
b) Checked to see if FlexIO would work. Test failed as it expected that the FlexIO Data pins were in flexio Sequence... But in this
case they are in reverse sequence. D0=15, D1=14, D2=13, D3=12.
c) Added the code to detect for this and to setup using the D3 value in this case D7 in 8-bit mode.
d) Camera still did not start up. Why the MCLK pin is not a PWM pin which the FlexIO code assumes... So detected it was on the correct
CSI pin and enabled the MCLK using the CSI stuff.
e) How to deal with the data lines reversed. In 8-bit mode, the code could simply use the SHIFTBUFBBS register instead of SHIFTBUF, that
reversed the bits in a byte. In the 4-bit mode we would need to reverse the bits in each nibble instead...
Current solution is to return the bytes in the nibble reversed order, and use a different mono-table to RGB conversion table:
I used a quick and dirty sketch to generate the table:
Will push some of this up later. Probably should confirm that most of the other cameras still work
But now time for yard...
But thought I would mention that I wanted to get all of the cameras to work on T4.1 on the CSI pins, that worked on the Micromod with
FlexIO. The main problem child is the Arducam HM01b0 sold by Arduino as well as Arducam. The main issue with this camera was
for some reason Arducam decided to not connect up D4-D7 pins, so this camera only works in 4 bit mode.
Problem is, CSI does not support 4-bit mode. But as mentioned a few messages up, the CSI pins are also FlexIO3 pins, so... I decided to see
if I could make it work! The answer is mostly...
But, it took a few attempts with missteps... Sort of along the lines:
a) It detected that CSI would not work...
b) Checked to see if FlexIO would work. Test failed as it expected that the FlexIO Data pins were in flexio Sequence... But in this
case they are in reverse sequence. D0=15, D1=14, D2=13, D3=12.
c) Added the code to detect for this and to setup using the D3 value in this case D7 in 8-bit mode.
d) Camera still did not start up. Why the MCLK pin is not a PWM pin which the FlexIO code assumes... So detected it was on the correct
CSI pin and enabled the MCLK using the CSI stuff.
e) How to deal with the data lines reversed. In 8-bit mode, the code could simply use the SHIFTBUFBBS register instead of SHIFTBUF, that
reversed the bits in a byte. In the 4-bit mode we would need to reverse the bits in each nibble instead...
Current solution is to return the bytes in the nibble reversed order, and use a different mono-table to RGB conversion table:
I used a quick and dirty sketch to generate the table:
C++:
uint8_t bit_map_table[] = {1<<3, 1<<2, 1<<1, 1<<0, 1<<7, 1<<6, 1<<5, 1<<4};
void setup() {
while (!Serial) {}
Serial.print("\nstatic const uint16_t mono_palette_4bit_rev[256] PROGMEM = {\n\t");
for (uint16_t i = 0; i <= 0xff; i++) {
uint8_t val_in = i;
uint8_t val_out = 0;
for (uint8_t bit_index = 0; val_in != 0; bit_index++) {
if (val_in & 1) val_out |= bit_map_table[bit_index];
val_in >>= 1;
}
Serial.printf("MCP(0x%02X)", val_out);
if (i != 0xff)Serial.print(", ");
if ((i & 0x7) == 0x7 ) Serial.print("\n\t");
}
Serial.println("};");
}
void loop() {
// put your main code here, to run repeatedly:
}
Will push some of this up later. Probably should confirm that most of the other cameras still work
But now time for yard...