Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: TMS320F28069, C2000WARE
Tool/software: Code Composer Studio
I am searching for a SSD1309 Driver and Graphics Library to Run on TMS320F28069 MCU
OLED - 2.7 Inch
Interface- SPI/DMA
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: TMS320F28069, C2000WARE
Tool/software: Code Composer Studio
I am searching for a SSD1309 Driver and Graphics Library to Run on TMS320F28069 MCU
OLED - 2.7 Inch
Interface- SPI/DMA
TI doesn't provide either of those. We don't provide a graphics library for the C2000. I know there are graphics libs for other TI MCUs (see the SimpleLink SDK), so you may be able to port one of those, but unfortunately we don't have anything that's ready to use.
The best I can point you to is our SPI and DMA examples in C2000Ware that will be able to help you write the drivers yourself.
Whitney
I have Ported a Library using Manu Abharam OLED Library.
But there is some problem
Uint16 rdata = 0x000; /* Received Data */
Uint16 sdata[128]; /* Send Data */
#pragma DATA_SECTION(fb, "DMARAML5") /* buffer in DMA L5 SRAM */
Uint16 fb[1023];
Uint16 init[] = {
0xae, /* DISPLAYOFF */
0xd5, /* SETDISPLAYCLOCKDIV to 0x80 */
0x80,
0xa8, /* SETMULTIPLEX */
LCDHEIGHT - 1,
0xd3, /* SETDISPLAYOFFSET to 0x00 */
0x00,
0x40, /* line #0 | SETSTARTLINE */
0x8d, /* CHARGEPUMP setup */
0x14,
0x20, /* MEMORYMODE addressing */
0x00,
0xa0 | 0x1, /* SEGREMAP, Yes */
0xc8, /* COMSCANDEC */
0xda, /* SETCOMPINS */
0x12,
0x81, /* SETCONTRAST to 0xef */
0xcf,
0xd9, /* SETPRECHARGE period */
0xf1,
0xdb, /* SETVCOMDETECT level */
0x40,
0xa4, /* DISPLAYALLON_RESUME */
0xa6, /* NORMALDISPLAY */
0x2e, /* SCROLL_DISABLE */
0xaf, /* DISPLAYON */
};
const char font[241][5] = // small 5x7 font
{
{0x00,0x00,0x00,0x00,0x00}, // ( 0) - 0x20 Space
{0x00,0x00,0x4F,0x00,0x00}, // ( 1) ! - 0x21 Exclamation Mark
{0x00,0x07,0x00,0x07,0x00}, // ( 2) " - 0x22 Quotation Mark
{0x14,0x7F,0x14,0x7F,0x14}, // ( 3) # - 0x23 Number Sign
{0x24,0x2A,0x7F,0x2A,0x12}, // ( 4) $ - 0x24 Dollar Sign
{0x23,0x13,0x08,0x64,0x62}, // ( 5) % - 0x25 Percent Sign
{0x36,0x49,0x55,0x22,0x50}, // ( 6) & - 0x26 Ampersand
{0x00,0x05,0x03,0x00,0x00}, // ( 7) ' - 0x27 Apostrophe
{0x00,0x1C,0x22,0x41,0x00}, // ( 8) ( - 0x28 Left Parenthesis
{0x00,0x41,0x22,0x1C,0x00}, // ( 9) ) - 0x29 Right Parenthesis
{0x14,0x08,0x3E,0x08,0x14}, // ( 10) * - 0x2A Asterisk
{0x08,0x08,0x3E,0x08,0x08}, // ( 11) + - 0x2B Plus Sign
{0x00,0x50,0x30,0x00,0x00}, // ( 12) , - 0x2C Comma
{0x08,0x08,0x08,0x08,0x08}, // ( 13) - - 0x2D Hyphen-Minus
{0x00,0x60,0x60,0x00,0x00}, // ( 14) . - 0x2E Point
{0x20,0x10,0x08,0x04,0x02}, // ( 15) / - 0x2F Solidus
{0x3E,0x51,0x49,0x45,0x3E}, // ( 16) 0 - 0x30 Digit Zero
{0x00,0x42,0x7F,0x40,0x00}, // ( 17) 1 - 0x31 Digit One
{0x42,0x61,0x51,0x49,0x46}, // ( 18) 2 - 0x32 Digit Two
{0x21,0x41,0x45,0x4B,0x31}, // ( 19) 3 - 0x33 Digit Three
{0x18,0x14,0x12,0x7F,0x10}, // ( 20) 4 - 0x34 Digit Four
{0x27,0x45,0x45,0x45,0x39}, // ( 21) 5 - 0x35 Digit Five
{0x3C,0x4A,0x49,0x49,0x30}, // ( 22) 6 - 0x36 Digit Six
{0x01,0x71,0x09,0x05,0x03}, // ( 23) 7 - 0x37 Digit Seven
{0x36,0x49,0x49,0x49,0x36}, // ( 24) 8 - 0x38 Digit Eight
{0x06,0x49,0x49,0x29,0x1E}, // ( 25) 9 - 0x39 Digit Nine
{0x00,0x36,0x36,0x00,0x00}, // ( 26) : - 0x3A Colon
{0x00,0x56,0x36,0x00,0x00}, // ( 27) ; - 0x3B Semicolon
{0x08,0x14,0x22,0x41,0x00}, // ( 28) < - 0x3C Less-Than Sign
{0x14,0x14,0x14,0x14,0x14}, // ( 29) = - 0x3D Equals Sign
{0x00,0x41,0x22,0x14,0x08}, // ( 30) > - 0x3E Greater-Than Sign
{0x02,0x01,0x51,0x09,0x06}, // ( 31) ? - 0x3F Question Mark
{0x32,0x49,0x79,0x41,0x3E}, // ( 32) @ - 0x40 Commercial At
{0x7E,0x11,0x11,0x11,0x7E}, // ( 33) A - 0x41 Latin Capital Letter A
{0x7F,0x49,0x49,0x49,0x36}, // ( 34) B - 0x42 Latin Capital Letter B
{0x3E,0x41,0x41,0x41,0x22}, // ( 35) C - 0x43 Latin Capital Letter C
{0x7F,0x41,0x41,0x22,0x1C}, // ( 36) D - 0x44 Latin Capital Letter D
{0x7F,0x49,0x49,0x49,0x41}, // ( 37) E - 0x45 Latin Capital Letter E
{0x7F,0x09,0x09,0x09,0x01}, // ( 38) F - 0x46 Latin Capital Letter F
{0x3E,0x41,0x49,0x49,0x7A}, // ( 39) G - 0x47 Latin Capital Letter G
{0x7F,0x08,0x08,0x08,0x7F}, // ( 40) H - 0x48 Latin Capital Letter H
{0x00,0x41,0x7F,0x41,0x00}, // ( 41) I - 0x49 Latin Capital Letter I
{0x20,0x40,0x41,0x3F,0x01}, // ( 42) J - 0x4A Latin Capital Letter J
{0x7F,0x08,0x14,0x22,0x41}, // ( 43) K - 0x4B Latin Capital Letter K
{0x7F,0x40,0x40,0x40,0x40}, // ( 44) L - 0x4C Latin Capital Letter L
{0x7F,0x02,0x0C,0x02,0x7F}, // ( 45) M - 0x4D Latin Capital Letter M
{0x7F,0x04,0x08,0x10,0x7F}, // ( 46) N - 0x4E Latin Capital Letter N
{0x3E,0x41,0x41,0x41,0x3E}, // ( 47) O - 0x4F Latin Capital Letter O
{0x7F,0x09,0x09,0x09,0x06}, // ( 48) P - 0x50 Latin Capital Letter P
{0x3E,0x41,0x51,0x21,0x5E}, // ( 49) Q - 0x51 Latin Capital Letter Q
{0x7F,0x09,0x19,0x29,0x46}, // ( 50) R - 0x52 Latin Capital Letter R
{0x46,0x49,0x49,0x49,0x31}, // ( 51) S - 0x53 Latin Capital Letter S
{0x01,0x01,0x7F,0x01,0x01}, // ( 52) T - 0x54 Latin Capital Letter T
{0x3F,0x40,0x40,0x40,0x3F}, // ( 53) U - 0x55 Latin Capital Letter U
{0x1F,0x20,0x40,0x20,0x1F}, // ( 54) V - 0x56 Latin Capital Letter V
{0x3F,0x40,0x38,0x40,0x3F}, // ( 55) W - 0x57 Latin Capital Letter W
{0x63,0x14,0x08,0x14,0x63}, // ( 56) X - 0x58 Latin Capital Letter X
{0x07,0x08,0x70,0x08,0x07}, // ( 57) Y - 0x59 Latin Capital Letter Y
{0x61,0x51,0x49,0x45,0x43}, // ( 58) Z - 0x5A Latin Capital Letter Z
{0x00,0x7F,0x41,0x41,0x00}, // ( 59) [ - 0x5B Left Square Bracket
{0x02,0x04,0x08,0x10,0x20}, // ( 58) \ - 0x5C Reverse Solidus
{0x00,0x41,0x41,0x7F,0x00}, // ( 61) ] - 0x5D Right Square Bracket
{0x04,0x02,0x01,0x02,0x04}, // ( 62) ^ - 0x5E Circumflex Accent
{0x40,0x40,0x40,0x40,0x40}, // ( 63) _ - 0x5F Low Line
{0x01,0x02,0x04,0x00,0x00}, // ( 64) ` - 0x60 Grave Accent
{0x20,0x54,0x54,0x54,0x78}, // ( 65) a - 0x61 Latin Small Letter A
{0x7F,0x48,0x44,0x44,0x38}, // ( 66) b - 0x62 Latin Small Letter B
{0x38,0x44,0x44,0x44,0x20}, // ( 67) c - 0x63 Latin Small Letter C
{0x38,0x44,0x44,0x48,0x7F}, // ( 68) d - 0x64 Latin Small Letter D
{0x38,0x54,0x54,0x54,0x18}, // ( 69) e - 0x65 Latin Small Letter E
{0x08,0x7E,0x09,0x01,0x02}, // ( 70) f - 0x66 Latin Small Letter F
{0x08,0x54,0x54,0x54,0x3C}, // ( 71) g - 0x67 Latin Small Letter G
{0x7F,0x08,0x04,0x04,0x78}, // ( 72) h - 0x68 Latin Small Letter H
{0x00,0x44,0x7D,0x40,0x00}, // ( 73) i - 0x69 Latin Small Letter I
{0x20,0x40,0x44,0x3D,0x00}, // ( 74) j - 0x6A Latin Small Letter J
{0x7F,0x10,0x28,0x44,0x00}, // ( 75) k - 0x6B Latin Small Letter K
{0x00,0x41,0x7F,0x40,0x00}, // ( 76) l - 0x6C Latin Small Letter L
{0x7C,0x04,0x18,0x04,0x7C}, // ( 77) m - 0x6D Latin Small Letter M
{0x7C,0x08,0x04,0x04,0x78}, // ( 78) n - 0x6E Latin Small Letter N
{0x38,0x44,0x44,0x44,0x38}, // ( 79) o - 0x6F Latin Small Letter O
{0x7C,0x14,0x14,0x14,0x08}, // ( 80) p - 0x70 Latin Small Letter P
{0x08,0x14,0x14,0x18,0x7C}, // ( 81) q - 0x71 Latin Small Letter Q
{0x7C,0x08,0x04,0x04,0x08}, // ( 82) r - 0x72 Latin Small Letter R
{0x48,0x54,0x54,0x54,0x20}, // ( 83) s - 0x73 Latin Small Letter S
{0x04,0x3F,0x44,0x40,0x20}, // ( 84) t - 0x74 Latin Small Letter T
{0x3C,0x40,0x40,0x20,0x7C}, // ( 85) u - 0x75 Latin Small Letter U
{0x1C,0x20,0x40,0x20,0x1C}, // ( 86) v - 0x76 Latin Small Letter V
{0x3C,0x40,0x30,0x40,0x3C}, // ( 87) w - 0x77 Latin Small Letter W
{0x44,0x28,0x10,0x28,0x44}, // ( 88) x - 0x78 Latin Small Letter X
{0x0C,0x50,0x50,0x50,0x3C}, // ( 89) y - 0x79 Latin Small Letter Y
{0x44,0x64,0x54,0x4C,0x44}, // ( 90) z - 0x7A Latin Small Letter Z
{0x00,0x08,0x36,0x41,0x00}, // ( 91) { - 0x7B Left Curly Bracket
{0x00,0x00,0x7F,0x00,0x00}, // ( 92) | - 0x7C Vertical Line
{0x00,0x41,0x36,0x08,0x00}, // ( 93) } - 0x7D Right Curly Bracket
{0x02,0x01,0x02,0x04,0x02}, // ( 94) ~ - 0x7E Tilde
{0x00,0x00,0x00,0x00,0x00}, // ( 95) - 0xA0 No-Break Space
{0x00,0x00,0x79,0x00,0x00}, // ( 96) ! - 0xA1 Inverted Exclamation Mark
{0x18,0x24,0x74,0x2E,0x24}, // ( 97) c - 0xA2 Cent Sign
{0x48,0x7E,0x49,0x42,0x40}, // ( 98) L - 0xA3 Pound Sign
{0x5D,0x22,0x22,0x22,0x5D}, // ( 99) o - 0xA4 Currency Sign
{0x15,0x16,0x7C,0x16,0x15}, // (100) Y - 0xA5 Yen Sign
{0x00,0x00,0x77,0x00,0x00}, // (101) | - 0xA6 Broken Bar
{0x0A,0x55,0x55,0x55,0x28}, // (102) § - 0xA7 Section Sign
{0x00,0x01,0x00,0x01,0x00}, // (103) " - 0xA8 Diaeresis
{0x3E,0x41,0x41,0x41,0x22}, // (104) (C)- 0xA9 Copyright
{0x00,0x0A,0x0D,0x0A,0x04}, // (105) - 0xAA Feminine Ordinal Indicator
{0x08,0x14,0x2A,0x14,0x22}, // (106) << - 0xAB Left-Pointing Double Angle Quotation Mark
{0x04,0x04,0x04,0x04,0x1C}, // (107) - 0xAC Not Sign
{0x00,0x08,0x08,0x08,0x00}, // (108) - - 0xAD Soft Hyphen
{0x7F,0x09,0x19,0x29,0x46}, // (109) (R)- 0xAE Registered
{0x01,0x01,0x01,0x01,0x01}, // (110) - 0xAF Macron
{0x00,0x02,0x05,0x02,0x00}, // (111) - 0xB0 Degree Sign
{0x44,0x44,0x5F,0x44,0x44}, // (112) +- - 0xB1 Plus-Minus Sign
{0x00,0x00,0x1D,0x17,0x00}, // (113) ² - 0xB2 SUPERSCRIPT TWO
{0x00,0x00,0x15,0x1F,0x00}, // (114) ³ - 0xB3 SUPERSCRIPT THREE
{0x00,0x00,0x04,0x02,0x01}, // (115) ` - 0xB4 Acute Accent
{0x7E,0x20,0x20,0x10,0x3E}, // (116) u - 0xB5 Micro Sign
{0x06,0x0F,0x7F,0x00,0x7F}, // (117) - 0xB6 Pilcrow Sign
{0x00,0x18,0x18,0x00,0x00}, // (118) . - 0xB7 Middle Dot
{0x00,0x40,0x50,0x20,0x00}, // (119) - 0xB8 Cedilla
{0x00,0x00,0x02,0x0F,0x00}, // (120) 1 - 0xB9 SUPERSCRIPT ONE
{0x00,0x0A,0x0D,0x0A,0x00}, // (121) - 0xBA Masculine Ordinal Indicator
{0x22,0x14,0x2A,0x14,0x08}, // (122) >> - 0xBB Right-Pointing Double Angle Quotation Mark
{0x17,0x08,0x34,0x2A,0x7D}, // (123) /4 - 0xBC Vulgar Fraction One Quarter
{0x17,0x08,0x04,0x6A,0x59}, // (124) /2 - 0xBD Vulgar Fraction One Half
{0x25,0x12,0x08,0x34,0x62}, // (125) 3/4- 0xBE Vulgar Fraction Three Quarter
{0x30,0x48,0x45,0x40,0x20}, // (126) ? - 0xBF Inverted Question Mark
{0x70,0x29,0x26,0x28,0x70}, // (127) `A - 0xC0 Latin Capital Letter A with Grave
{0x70,0x28,0x26,0x29,0x70}, // (128) 'A - 0xC1 Latin Capital Letter A with Acute
{0x70,0x2A,0x25,0x2A,0x70}, // (129) ^A - 0xC2 Latin Capital Letter A with Circumflex
{0x72,0x29,0x26,0x29,0x70}, // (130) ~A - 0xC3 Latin Capital Letter A with Tilde
{0x70,0x29,0x24,0x29,0x70}, // (131) "A - 0xC4 Latin Capital Letter A with Diaeresis
{0x70,0x2A,0x2D,0x2A,0x70}, // (132) A - 0xC5 Latin Capital Letter A with Ring Above
{0x7E,0x11,0x7F,0x49,0x49}, // (133) AE - 0xC6 Latin Capital Letter Ae
{0x0E,0x51,0x51,0x71,0x11}, // (134) C - 0xC7 Latin Capital Letter C with Cedilla
{0x7C,0x55,0x56,0x54,0x44}, // (135) `E - 0xC8 Latin Capital Letter E with Grave
{0x7C,0x55,0x56,0x54,0x44}, // (136) 'E - 0xC9 Latin Capital Letter E with Acute
{0x7C,0x56,0x55,0x56,0x44}, // (137) ^E - 0xCA Latin Capital Letter E with Circumflex
{0x7C,0x55,0x54,0x55,0x44}, // (138) "E - 0xCB Latin Capital Letter E with Diaeresis
{0x00,0x45,0x7E,0x44,0x00}, // (139) `I - 0xCC Latin Capital Letter I with Grave
{0x00,0x44,0x7E,0x45,0x00}, // (140) 'I - 0xCD Latin Capital Letter I with Acute
{0x00,0x46,0x7D,0x46,0x00}, // (141) ^I - 0xCE Latin Capital Letter I with Circumflex
{0x00,0x45,0x7C,0x45,0x00}, // (142) "I - 0xCF Latin Capital Letter I with Diaeresis
{0x7F,0x49,0x49,0x41,0x3E}, // (143) D - 0xD0 Latin Capital Letter Eth
{0x7C,0x0A,0x11,0x22,0x7D}, // (144) ~N - 0xD1 Latin Capital Letter N with Tilde
{0x38,0x45,0x46,0x44,0x38}, // (145) `O - 0xD2 Latin Capital Letter O with Grave
{0x38,0x44,0x46,0x45,0x38}, // (146) 'O - 0xD3 Latin Capital Letter O with Acute
{0x38,0x46,0x45,0x46,0x38}, // (147) ^O - 0xD4 Latin Capital Letter O with Circumflex
{0x38,0x46,0x45,0x46,0x39}, // (148) ~O - 0xD5 Latin Capital Letter O with Tilde
{0x38,0x45,0x44,0x45,0x38}, // (149) "O - 0xD6 Latin Capital Letter O with Diaeresis
{0x22,0x14,0x08,0x14,0x22}, // (150) x - 0xD7 Multiplcation Sign
{0x2E,0x51,0x49,0x45,0x3A}, // (151) O - 0xD8 Latin Capital Letter O with Stroke
{0x3C,0x41,0x42,0x40,0x3C}, // (152) `U - 0xD9 Latin Capital Letter U with Grave
{0x3C,0x40,0x42,0x41,0x3C}, // (153) 'U - 0xDA Latin Capital Letter U with Acute
{0x3C,0x42,0x41,0x42,0x3C}, // (154) ^U - 0xDB Latin Capital Letter U with Circumflex
{0x3C,0x41,0x40,0x41,0x3C}, // (155) "U - 0xDC Latin Capital Letter U with Diaeresis
{0x0C,0x10,0x62,0x11,0x0C}, // (156) `Y - 0xDD Latin Capital Letter Y with Acute
{0x7F,0x12,0x12,0x12,0x0C}, // (157) P - 0xDE Latin Capital Letter Thom
{0x40,0x3E,0x01,0x49,0x36}, // (158) B - 0xDF Latin Capital Letter Sharp S
{0x20,0x55,0x56,0x54,0x78}, // (159) `a - 0xE0 Latin Small Letter A with Grave
{0x20,0x54,0x56,0x55,0x78}, // (160) 'a - 0xE1 Latin Small Letter A with Acute
{0x20,0x56,0x55,0x56,0x78}, // (161) ^a - 0xE2 Latin Small Letter A with Circumflex
{0x20,0x55,0x56,0x55,0x78}, // (162) ~a - 0xE3 Latin Small Letter A with Tilde
{0x20,0x55,0x54,0x55,0x78}, // (163) "a - 0xE4 Latin Small Letter A with Diaeresis
{0x20,0x56,0x57,0x56,0x78}, // (164) a - 0xE5 Latin Small Letter A with Ring Above
{0x24,0x54,0x78,0x54,0x58}, // (165) ae - 0xE6 Latin Small Letter Ae
{0x0C,0x52,0x52,0x72,0x13}, // (166) c - 0xE7 Latin Small Letter c with Cedilla
{0x38,0x55,0x56,0x54,0x18}, // (167) `e - 0xE8 Latin Small Letter E with Grave
{0x38,0x54,0x56,0x55,0x18}, // (168) 'e - 0xE9 Latin Small Letter E with Acute
{0x38,0x56,0x55,0x56,0x18}, // (169) ^e - 0xEA Latin Small Letter E with Circumflex
{0x38,0x55,0x54,0x55,0x18}, // (170) "e - 0xEB Latin Small Letter E with Diaeresis
{0x00,0x49,0x7A,0x40,0x00}, // (171) `i - 0xEC Latin Small Letter I with Grave
{0x00,0x48,0x7A,0x41,0x00}, // (172) 'i - 0xED Latin Small Letter I with Acute
{0x00,0x4A,0x79,0x42,0x00}, // (173) ^i - 0xEE Latin Small Letter I with Circumflex
{0x00,0x4A,0x78,0x42,0x00}, // (174) "i - 0xEF Latin Small Letter I with Diaeresis
{0x31,0x4A,0x4E,0x4A,0x30}, // (175) - 0xF0 Latin Small Letter Eth
{0x7A,0x11,0x0A,0x09,0x70}, // (176) ~n - 0xF1 Latin Small Letter N with Tilde
{0x30,0x49,0x4A,0x48,0x30}, // (177) `o - 0xF2 Latin Small Letter O with Grave
{0x30,0x48,0x4A,0x49,0x30}, // (178) 'o - 0xF3 Latin Small Letter O with Acute
{0x30,0x4A,0x49,0x4A,0x30}, // (179) ^o - 0xF4 Latin Small Letter O with Circumflex
{0x30,0x4A,0x49,0x4A,0x31}, // (180) ~o - 0xF5 Latin Small Letter O with Tilde
{0x30,0x4A,0x48,0x4A,0x30}, // (181) "o - 0xF6 Latin Small Letter O with Diaeresis
{0x08,0x08,0x2A,0x08,0x08}, // (182) + - 0xF7 Division Sign
{0x38,0x64,0x54,0x4C,0x38}, // (183) o - 0xF8 Latin Small Letter O with Stroke
{0x38,0x41,0x42,0x20,0x78}, // (184) `u - 0xF9 Latin Small Letter U with Grave
{0x38,0x40,0x42,0x21,0x78}, // (185) 'u - 0xFA Latin Small Letter U with Acute
{0x38,0x42,0x41,0x22,0x78}, // (186) ^u - 0xFB Latin Small Letter U with Circumflex
{0x38,0x42,0x40,0x22,0x78}, // (187) "u - 0xFC Latin Small Letter U with Diaeresis
{0x0C,0x50,0x52,0x51,0x3C}, // (188) 'y - 0xFD Latin Small Letter Y with Acute
{0x7E,0x14,0x14,0x14,0x08}, // (189) p - 0xFE Latin Small Letter Thom
{0x0C,0x51,0x50,0x51,0x3C} // (190) "y - 0xFF Latin Small Letter Y with Diaeresis
};
void init_mcbsp_gpio(void)
{
EALLOW;
/**
* Configure McBSP-A pins using GPIO regs: Table 1-64, Table 1-65, spruh18g.pdf
* This specifies which of the possible GPIO pins will be McBSP functional pins
*/
GpioCtrlRegs.GPAMUX2.bit.GPIO20 = 2; /* GPIO20=MDXA, data tx, MOSI */
GpioCtrlRegs.GPAMUX2.bit.GPIO22 = 2; /* GPIO22=CLKXA, clk tx, SCL */
/**
* Set qualification for selected input pins to asynch only
* This will select asynch (no qualification) for the selected pins
* Asynchronous option applies to pins configured as pripherals only
*/
GpioCtrlRegs.GPAQSEL2.bit.GPIO22 = 3; /* Asynch input GPIO22 (MCLKXA) */
EDIS;
}
void setup_lcd_pins(void)
{
EALLOW;
GpioCtrlRegs.GPAPUD.bit.GPIO23 = 1; /* disable pullup for RESET */
GpioCtrlRegs.GPBPUD.bit.GPIO44 = 1; /* disable pullup for D/C */
GpioCtrlRegs.GPAMUX2.bit.GPIO23 = 0; /* setup GPIO::RESET */
GpioCtrlRegs.GPBMUX1.bit.GPIO44 = 0; /* setup GPIO::D/C */
GpioCtrlRegs.GPADIR.bit.GPIO23 = 1; /* setup Output::Reset */
GpioCtrlRegs.GPBDIR.bit.GPIO44 = 1; /* setup Output::D/C */
EDIS;
GpioDataRegs.GPASET.bit.GPIO22 = 1; /* RESET default HIGH (Release) */
}
void init_mcbsp_spi(void)
{
/**
* init SPI peripheral:
* spruh18g Page:968, 15.7.5, 15.7.6
*/
McbspaRegs.SPCR2.all = 0x0000; /* Reset FS gen, SRG & Tx */
McbspaRegs.SPCR1.all = 0x0000; /* Reset Rx, Right justify, DLB dis */
McbspaRegs.PCR.all = 0x0F08; /* (CLKXM=CLKRM=FSXM=FSRM=1,FSXP=1) */
McbspaRegs.SPCR1.bit.DLB = 1;
McbspaRegs.MFFINT.all = 0x0; /* Disable all interrupts */
McbspaRegs.SPCR1.bit.CLKSTP = 3; // 2 /* clock schema with CLKXP/CLKRP */
McbspaRegs.PCR.bit.CLKXP = 0; // 0 /* CPOL=0,CPHA=1,rise edge,no */
McbspaRegs.PCR.bit.CLKRP = 1; // 0 /* if CLKSTP=2, then CPHA=0 */
McbspaRegs.RCR2.bit.RDATDLY = 01; /* FSX setup time 1 = master mode */
McbspaRegs.XCR2.bit.XDATDLY = 01; /* FSX setup time 1 = master mode */
McbspaRegs.RCR1.bit.RWDLEN1 = 0; // 5 /* 5=32-bit 0=8-bit word */
McbspaRegs.XCR1.bit.XWDLEN1 = 0; // 5 /* 5=32-bit 0=8-bit word */
McbspaRegs.SRGR2.all = 0x2000; /* CLKSM=1, FPER=1 CLKG periods */
McbspaRegs.SRGR1.all = 0x000f; /* Frame Width=1, CLKGDV=16; 0x0f */
McbspaRegs.SPCR2.bit.GRST = 1; /* Enable the sample rate generator */
DELAY_US(1); /* Wait at least 2 SRG clock cycles */
McbspaRegs.SPCR2.bit.XRST = 1; /* Release TX from Reset */
McbspaRegs.SPCR1.bit.RRST = 1; /* Release RX from Reset */
McbspaRegs.SPCR2.bit.FRST = 1; /* Frame Sync Generator reset */
}
void ssd1306_reset(void)
{
GpioDataRegs.GPACLEAR.bit.GPIO23 = 1; /* RESET = 0 */
DELAY_US(10000); /* wait 10ms */
GpioDataRegs.GPASET.bit.GPIO23 = 1; /* RESET = 1 */
DELAY_US(50000); /* wait 50mS */
}
void spi_send(Uint16 *data, int len)
{
Uint8 i;
for (i = 0; i < len; i++) {
McbspaRegs.DXR1.all = data[i]; /* send data */
while (McbspaRegs.SPCR1.bit.RRDY == 0) {} /* wait till done */
rdata = McbspaRegs.DRR1.all;
if (rdata != data[i])
error();
}
}
void ssd1306_init(void)
{
GpioDataRegs.GPBCLEAR.bit.GPIO44 = 1; /* D/C default LOW (CMD MODE) */
spi_send(init, sizeof (init));
}
/**
* Set window region for GDDRAM access
* void lcd_set_window(uint16_t c_start,
* uint16_t p_start,
* uint16_t c_stop,
* uint16_t p_stop)
*
* @uint16_t c_start : COLUMN start address
* @uint16_t p_start : PAGE start address
* @uint16_t c_stop : COLUMN end address
* @uint16_t p_stop : PAGE end address
*
* GDDRAM PAGE Structure
* ---------------------
* PAGE0 ########----------------########
* PAGE1 ########----------------########
* PAGE2 ########----------------########
* PAGE3 ########----------------########
* PAGE4 ########----------------########
* PAGE5 ########----------------########
* PAGE6 ########----------------########
* PAGE7 ########----------------########
* ^ ^
* | |
* SEG0 ---------------------- SEG127
* SEG127 -------------------- SEG0 COLUMN remap
*
* GDDRAM PAGE Bitmap
* ---------------------
* ____ SEG0 SEG127 __
* | ___ SEG1 SEG126 _ |
* || __ SEG2 ||
* ||| _ SEG3 ||
* |||| ||
* vvvv vv
* ########----------------######## <- D0
* ########----------------######## <- D1
* ########----------------######## <- D2
* ########----------------######## <- D3
* ########----------------######## <- D4
* ########----------------######## <- D5
* ########----------------######## <- D6
* ########----------------######## <- D7
*/
void lcd_set_window(Uint16 c_start,
Uint16 p_start,
Uint16 c_stop,
Uint16 p_stop)
{
sdata[0] = COLUMNADDR; /* Set Column Address (0x21) */
sdata[1] = c_start; /* COL start; eg 0 */
sdata[2] = c_stop; /* COL end; max 'lcdwidth -1'; 127 */
sdata[3] = PAGEADDR; /* Set Page Address (0x22) */
sdata[4] = p_start; /* PAGE start; 0 */
sdata[5] = p_stop; /* PAGE end; max=7((lcdheight/8)-1) */
GpioDataRegs.GPBCLEAR.bit.GPIO44 = 1; /* CMD mode */
spi_send(sdata, 6); /* transfer 6 bytes */
}
void lcd_fb_put(void)
{
GpioDataRegs.GPBSET.bit.GPIO44 = 1; /* D/C default HIGH (DATA MODE) */
spi_send(fb, sizeof (fb)); /* SSD1306 Graphic data */
}
void fb_clear(void)
{
Uint16 i;
for (i = 0; i < (LCDWIDTH * LCDHEIGHT / 8); i++)
fb[i] = 0x00;
}
void ssd1309_print_P(const char* aString, unsigned int page, unsigned int startColumn)
{
unsigned int tmp;
const char* Src_Pointer = aString; // copy the pointer, because will will increment it
tmp = *(Src_Pointer);
while(tmp != '\0')
{
ssd1309_putc(tmp, page, startColumn);
Src_Pointer++;
tmp = *(Src_Pointer);
startColumn+=6;
}
}
void ssd1309_print(char *aString, unsigned int page, unsigned int startColumn)
{
char * Src_Pointer = aString; // copy the pointer, because will will increment it
while(*Src_Pointer != '\0') // until string end
{
ssd1309_putc((unsigned char)*Src_Pointer, page, startColumn);
Src_Pointer++;
startColumn+=6;
}
}
void show_image (char* a)
{
int i=0;
fb_clear(); /* clear fb array */
for (i = 0; i < 1023; i++)
fb[i] = a[i];
lcd_fb_put(); /* write to ssd1306 */
}
void cmd_ContrastControl(Uint16 a)
{
// char z=0;
sdata[0] = 0x81; /* Set Column Address (0x21) */
sdata[1] = a; /* COL start; eg 0 */
GpioDataRegs.GPBCLEAR.bit.GPIO44 = 1; /* CMD mode */
spi_send(sdata, 2); /* transfer 6 bytes*/
}
void flip_screen()
{
sdata[0] = 0xA0; /* Set Column Address (0x21) */
sdata[1] = ( ((0xc8) >> 8) | 0xc0 ); /* COL start; eg 0 */
GpioDataRegs.GPBCLEAR.bit.GPIO44 = 1; /* CMD mode */
spi_send(sdata, 2); /* transfer 6 bytes*/
}/*#############################################################################
############### command functions, not for user interaction ###################
#############################################################################*/
/**
* @brief Set the memory addressing mode
*
* For more information see SSD1309 datasheet.
*
* @param mode 0 = Horizontal Addressing Mode
* 1 = Vertical Addressing Mode
* 2 = Page Addressing Mode (default)
*/
void cmd_AddressingMode(unsigned int mode)
{
sdata[0] = 0x20; /* Set Column Address (0x21) */
sdata[1] = mode; /* COL start; eg 0 */
GpioDataRegs.GPBCLEAR.bit.GPIO44 = 1; /* CMD mode */
spi_send(sdata, 2); /* transfer 6 bytes*/
}
/**
* @brief Set column start Address for Page Addressing Mode
*
* Set the column start address register for Page Addressing Mode.
* The initial display line register is reset to 0x00 after RESET.
*
* @note This command is only for page addressing mode.
*
* @param address The start address (0-255?)
*/
void cmd_ColumnStartAddress(unsigned int address)
{
// Default => 0x10
sdata[0] = (0x00+address%16); /* Set Column Address (0x21) */
sdata[1] = (0x10+address/16); /* COL start; eg 0 */
GpioDataRegs.GPBCLEAR.bit.GPIO44 = 1; /* CMD mode */
spi_send(sdata, 2); /* transfer 6 bytes*/
}
/**
* @brief Set Page Start Address for Page Addressing Mode
*
* Set GDDRAM Page Start Address (PAGE0~PAGE7) for Page Addressing Mode.
*
* @note This command is only for page addressing mode.
*
* @param page The start page (0-7)
*/
void cmd_PageStartAddress(unsigned int page)
{
sdata[0] = (0xB0|page); /* Set Column Address (0x21) */
GpioDataRegs.GPBCLEAR.bit.GPIO44 = 1; /* CMD mode */
spi_send(sdata, 1); /* transfer 6 bytes*/
}
void ssd1309_putc(unsigned char aChar, unsigned int page, unsigned int startColumn)
{
unsigned int i;
if((aChar >= 0x20) && (aChar <= 0x7E)) // normal ASCII Char
{
aChar -= 0x20; // subtract to match index
}
else if (aChar >= 0xA0) // extended UTF8 char
{
aChar -= 0x41; // subtract to match index
}
else // char not available
{
aChar = '?' - 0x20; // make a ?
}
cmd_PageStartAddress(page);
cmd_ColumnStartAddress(startColumn);
for(i=0;i<5;i++)
{
fb[i]=(*(&font[aChar][i]));
}
lcd_fb_put();
}
Main Code
/**
* The example transfers 8bits of data internally with the Digital LoopBack(DLB)
* with the McBSP module in SPI Master mode.
* The waveforms are observable on the following SPI pins:
*
* RESET GPIO23 Pin #49
* MOSI GPIO20 Pin #45 MDX
* SCL GPIO22 Pin #08 MCLKX
* D/C GPIO44 Pin #18
*
* By default for the McBSP examples, the McBSP sample rate generator (SRG)
* input clock frequency is LSPCLK 80E6/4.
*
*/
#include "DSP28x_Project.h"
#include "F2806x_Examples.h"
#include "string.h"
#include "stdlib.h"
#include "SSD1309.h"
void error(void)
{
__asm(" ESTOP0"); /* test failed!! Stop! */
for (;;);
}
void main(void)
{
Uint8 i;
InitSysCtrl(); /* PLL, WatchDog, Peripheral Clk's */
init_mcbsp_gpio(); /* enable the GPIO for McBSP-A */
DINT;
InitPieCtrl();
IER = 0x0000; /* Disable CPU interrupts */
IFR = 0x0000; /* Clear all CPU interrupt flags */
InitPieVectTable();
init_mcbsp_spi();
// InitFlash();
setup_lcd_pins();
ssd1306_reset(); /* Reset LCD */
ssd1306_init(); /* initialize LCD */
lcd_set_window(0, 0, 127, 7); /* setup access gddram */
fb_clear(); /* clear fb array */
ssd1309_putc('1',0,0);
ssd1309_print("123",0,0);
while (1)
{
// ssd1309_print("123",0,0);
//
}
}
Problem is when I write ssd1309_print("123",0,0);
The Display only displays 3
Have you looked at the transmissions on the pins using an oscilloscope or logic analyzer to see if the correct data is being sent?
It looks like you've probably already put thought into this, but one thing that often causes problems when porting code from other devices to C2000 is that C2000 doesn't have an 8-bit data type, so all those chars and Uint8s are actually 16 bits. It's something to keep in mind as you debug.
Whitney