CDM101 part 1 : first light

As I promised you back in the CDM102 Bed clock part 1. The CDM101 is finally here!

Quite similar isn’t it?
From the back side.
Close up shot at the PCB.

For the pinout. It’s 100% identical to the CDM102.

  1. /Load
  2. VCC
  3. SCLK
  4. GND
  5. SDI
  6. /RST

The pinout was the same. But the pixels pattern and data packet is a bit lot different.

Pixel format

CDM101 divided display region into 2 distinct group. Refer to the first Pics, You can clearly see the different between The 4 x16 LEDs and Solid white region on the left.

Let’s first talk about the 4×16 LEDs

These 4×16 LEDs are divided into 2 4-by-7 groups plus 2 special columns (15 and 16), Using 0xAX and 0xBX commands like CDM102. One byte still contain 1 column of pixel data. But things get weird. The left hand group and right hand group have different Pixel data order. Also The LEDs in column 15 and column 16 is controlled by Bit 0 as I will show you down below :

Left hand group :

BitByte 0Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6
0000000Col15Row4
1Col1Row4Col2Row4Col3Row4Col4Row4Col5Row4Col6Row4Col7Row4
2Col1Row3Col2Row3Col3Row3Col4Row3Col5Row3Col6Row3Col7Row3
3Col1Row2Col2Row2Col3Row2Col4Row2Col5Row2Col6Row2Col7Row2
4Col1Row1Col2Row1Col3Row1Col4Row1Col5Row1Col6Row1Col7Row1
50000000
60000000
70000000
Left hand Group

Right hand group

BitByte 0Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6
0Col16Row4Col16Row3Col15Row3Col16Row1Col16Row2Col15Row1Col15Row2
1Col8Row1Col9Row1Col10Row1Col11Row1Col12Row1Col13Row1Col14Row1
2Col8Row2Col9Row2Col10Row2Col11Row2Col12Row2Col13Row2Col14Row2
3Col8Row3Col9Row3Col10Row3Col11Row3Col12Row3Col13Row3Col14Row3
4Col8Row4Col9Row4Col10Row4Col11Row4Col12Row4Col13Row4Col14Row4
50000000
60000000
70000000
Right hand group

Last night. I wrote some little function that will render the image from 2 bit per pixel frame buffer to CDM101 display. It’s quite a pain is the but. But It’s working UwU :

// Render frame buffer and send frame data to display.
void cdm101_rndr(){

	/*
	*	Left hand Group (Col 1-7) + Col15,Row4 Dot
	*/

	cdm101_tx(0xB0);// Green pixel left hand group.
	cdm101_tx( (uint8_t)((FB[12] & 0x80) >> 3) | (uint8_t)((FB[8] & 0x80) >> 4) | (uint8_t)((FB[4] & 0x80) >> 5) | (uint8_t)((FB[0] & 0x80) >> 6) );// Col1 
	cdm101_tx( (uint8_t)((FB[12] & 0x20) >> 1) | (uint8_t)((FB[8] & 0x20) >> 2) | (uint8_t)((FB[4] & 0x20) >> 3) | (uint8_t)((FB[0] & 0x20) >> 4) );// Col2 
	cdm101_tx( (uint8_t)((FB[12] & 0x08) << 1) | (uint8_t)(FB[8] & 0x08) 	    | (uint8_t)((FB[4] & 0x08) >> 1) | (uint8_t)((FB[0] & 0x08) >> 2) );// Col3 
	cdm101_tx( (uint8_t)((FB[12] & 0x02) << 3) | (uint8_t)((FB[8] & 0x02) << 2) | (uint8_t)((FB[4] & 0x02) << 1) | (uint8_t)(FB[0] & 0x02) 		  );// Col4 
	
	cdm101_tx( (uint8_t)((FB[13] & 0x80) >> 3) | (uint8_t)((FB[9] & 0x80) >> 4) | (uint8_t)((FB[5] & 0x80) >> 5) | (uint8_t)((FB[1] & 0x80) >> 6) );// Col5 
	cdm101_tx( (uint8_t)((FB[13] & 0x20) >> 1) | (uint8_t)((FB[9] & 0x20) >> 2) | (uint8_t)((FB[5] & 0x20) >> 3) | (uint8_t)((FB[1] & 0x20) >> 4) );// Col6 
	cdm101_tx( (uint8_t)((FB[13] & 0x08) << 1) | (uint8_t)(FB[9] & 0x08) 	    | (uint8_t)((FB[5] & 0x08) >> 1) | (uint8_t)((FB[1] & 0x08) >> 2) | (uint8_t)((FB[15] & 0x08) >> 3));// Col7 + Col15,Row4 Dot

	cdm101_tx(0xB2);// Orange pixel left hand group.
	cdm101_tx( (uint8_t)((FB[12] & 0x40) >> 2) | (uint8_t)((FB[8] & 0x40) >> 3) | (uint8_t)((FB[4] & 0x40) >> 4) | (uint8_t)((FB[0] & 0x40) >> 5) );// Col1 
	cdm101_tx( (uint8_t)(FB[12] & 0x10)		   | (uint8_t)((FB[8] & 0x10) >> 1) | (uint8_t)((FB[4] & 0x10) >> 2) | (uint8_t)((FB[0] & 0x10) >> 3) );// Col2 
	cdm101_tx( (uint8_t)((FB[12] & 0x04) << 2) | (uint8_t)((FB[8] & 0x04) << 1) | (uint8_t)(FB[4] & 0x04) 		 | (uint8_t)((FB[0] & 0x04) >> 1) );// Col3 
	cdm101_tx( (uint8_t)((FB[12] & 0x01) << 4) | (uint8_t)((FB[8] & 0x01) << 3) | (uint8_t)((FB[4] & 0x01) << 2) | (uint8_t)((FB[0] & 0x01) << 1) );// Col4 
	
	cdm101_tx( (uint8_t)((FB[13] & 0x40) >> 2) | (uint8_t)((FB[9] & 0x40) >> 3) | (uint8_t)((FB[5] & 0x40) >> 4) | (uint8_t)((FB[1] & 0x40) >> 5) );// Col5 
	cdm101_tx( (uint8_t)(FB[13] & 0x10) 	   | (uint8_t)((FB[9] & 0x10) >> 1) | (uint8_t)((FB[5] & 0x10) >> 2) | (uint8_t)((FB[1] & 0x10) >> 3) );// Col6 
	cdm101_tx( (uint8_t)((FB[13] & 0x04) << 2) | (uint8_t)((FB[9] & 0x04) << 1) | (uint8_t)(FB[5] & 0x04) 		 | (uint8_t)((FB[1] & 0x04) >> 1) | (uint8_t)((FB[15] & 0x04) >> 2));// Col7 + Col15,Row4 Dot
	
	
	/*
	*	Right hand Group (Col 8-14) + Col 15 and Col 1t
	*/
	
	cdm101_tx(0xB1);// Green pixel right hand group.
	cdm101_tx( (uint8_t)(FB[1] & 0x02)        | (uint8_t)((FB[5] & 0x02) << 1)  | (uint8_t)((FB[9] & 0x02) << 2) | (uint8_t)((FB[13] & 0x02) << 3) | (uint8_t)((FB[15] & 0x02) >> 1));// Col8 + Col16,Row4 Dot
	
	cdm101_tx( (uint8_t)((FB[2] & 0x80) >> 6) | (uint8_t)((FB[6] & 0x80) >> 5) | (uint8_t)((FB[10] & 0x80) >> 4) | (uint8_t)((FB[14] & 0x80) >> 3) | (uint8_t)((FB[11] & 0x02) >> 1));// Col9 + Col16,Row3 Dot
	cdm101_tx( (uint8_t)((FB[2] & 0x20) >> 4) | (uint8_t)((FB[6] & 0x20) >> 3) | (uint8_t)((FB[10] & 0x20) >> 2) | (uint8_t)((FB[14] & 0x20) >> 1) | (uint8_t)((FB[11] & 0x08) >> 3));// Col10 + Col15,Row3 Dot
	cdm101_tx( (uint8_t)((FB[2] & 0x08) >> 2) | (uint8_t)((FB[6] & 0x08) >> 1) | (uint8_t)(FB[10] & 0x08) 		 | (uint8_t)((FB[14] & 0x08) << 1) | (uint8_t)((FB[3] & 0x02) >> 1) );// Col11 + Col16,Row1 Dot	
	cdm101_tx( (uint8_t)(FB[2] & 0x02) 	      | (uint8_t)((FB[6] & 0x02) << 1) | (uint8_t)((FB[10] & 0x02) << 2) | (uint8_t)((FB[14] & 0x02) << 3) | (uint8_t)((FB[3] & 0x02) >> 1) );// Col12 + Col16,Row2 Dot
	
	cdm101_tx( (uint8_t)((FB[3] & 0x80) >> 6) | (uint8_t)((FB[7] & 0x80) >> 5) | (uint8_t)((FB[11] & 0x80) >> 4) | (uint8_t)((FB[15] & 0x80) >> 3) | (uint8_t)((FB[3] & 0x08) >> 3) );// Col13 + Col15,Row1 Dot
	cdm101_tx( (uint8_t)((FB[3] & 0x20) >> 4) | (uint8_t)((FB[7] & 0x20) >> 3) | (uint8_t)((FB[11] & 0x20) >> 2) | (uint8_t)((FB[15] & 0x20) >> 1) | (uint8_t)((FB[7] & 0x08) >> 3) );// Col14 + Col15,Row2 Dot
	
	cdm101_tx(0xB3);// Orange pixel right hand group.
	cdm101_tx( (uint8_t)((FB[1] & 0x01) << 1) | (uint8_t)((FB[5] & 0x01) << 2)  | (uint8_t)((FB[9] & 0x01) << 3) | (uint8_t)((FB[13] & 0x01) << 4) | (uint8_t)(FB[15] & 0x01)		);// Col8 + Col16,Row4 Dot
	
	cdm101_tx( (uint8_t)((FB[2] & 0x40) >> 5) | (uint8_t)((FB[6] & 0x40) >> 4) | (uint8_t)((FB[10] & 0x40) >> 3) | (uint8_t)((FB[14] & 0x40) >> 2) | (uint8_t)(FB[11] & 0x01)		);// Col9 + Col16,Row3 Dot
	cdm101_tx( (uint8_t)((FB[2] & 0x10) >> 3) | (uint8_t)((FB[6] & 0x10) >> 2) | (uint8_t)((FB[10] & 0x10) >> 1) | (uint8_t)(FB[14] & 0x10) 	   | (uint8_t)((FB[11] & 0x04) >> 2));// Col10 + Col15,Row3 Dot
	cdm101_tx( (uint8_t)((FB[2] & 0x04) >> 1) | (uint8_t)(FB[6] & 0x04)		   | (uint8_t)((FB[10] & 0x04) << 1) | (uint8_t)((FB[14] & 0x04) << 2) | (uint8_t)(FB[3] & 0x01)		);// Col11 + Col16,Row1 Dot
	cdm101_tx( (uint8_t)((FB[2] & 0x01) << 1) | (uint8_t)((FB[6] & 0x01) << 2) | (uint8_t)((FB[10] & 0x01) << 3) | (uint8_t)((FB[14] & 0x01) << 4) | (uint8_t)(FB[7] & 0x01)		);// Col12 + Col16,Row2 Dot
	
	cdm101_tx( (uint8_t)((FB[3] & 0x40) >> 5) | (uint8_t)((FB[7] & 0x40) >> 4) | (uint8_t)((FB[11] & 0x40) >> 3) | (uint8_t)((FB[15] & 0x40) >> 2) | (uint8_t)((FB[3] & 0x04) >> 2) );// Col13 + Col15,Row1
	cdm101_tx( (uint8_t)((FB[3] & 0x10) >> 3) | (uint8_t)((FB[7] & 0x10) >> 2) | (uint8_t)((FB[11] & 0x10) >> 1) | (uint8_t)(FB[15] & 0x10)		   | (uint8_t)((FB[7] & 0x04) >> 2) );// Col14 + Col15,Row4 Dot

	
}

As you can see, The code is really messy (on WordPress). I suggest you to have a better look at the code here over my GitHub repo.

With some testing and debugging. The result from the code was something like this :

Nicey test pattern UwU

There’s one more thing to do though. There’s Orange LEDs on the left side of the display. I wasn’t able to control individual pixel yet. I’m sure that it’s possible. So stayed tune for part 2!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s