Altitude Posted August 7, 2011 Report Posted August 7, 2011 So Newhaven has a line of 4X20 OLEDs out and I thought it would make for a nice upgrade for my MB6582 but looking at the data sheet, the connections look a little different from what I am used to, can anyone shed some light on how this should be connected? http://www.newhavendisplay.com/specs/NHD-0420DZW-AY5.pdf Quote
jojjelito Posted August 7, 2011 Report Posted August 7, 2011 This pinning/connection schema is the same as usual, but omit pins 3, 15 and 16. However, the 6582 apparently runs the display in 4-bit mode so you can also omit pins 7-10 if you run the display with 4-bit mode code. Hawkeye posted a 4-bit VFD driver that can be hacked into getting the Newhaven to behave. I got sidetracked on this during the server move and holidays, but I intend to post my code as soon as work begins anew and I can get back to this topic. /J Quote
Altitude Posted August 7, 2011 Author Report Posted August 7, 2011 (edited) Thats the direction I am going but I cant get it running in 8 or 4 bit mode on a standard core Edited August 8, 2011 by Altitude Quote
Hawkeye Posted August 8, 2011 Report Posted August 8, 2011 (edited) I know the troubles, had a Newhaven clone (Electronic Assembly) for some time (until it burned on me for no reason) - it stayed nicely black after wiring - then after a few hours of hacking, I managed to get nice (oled ftw) but still garbage output, it looked like it was expecting 8-bit input, but the MB6582 is wired only for 4-bit mode, init failure so to say... Methinks, that the state, jojjelito is in currently in with his driver adaptation is similar - if you want to try your codes, you can use VFD driver as a base (4-bit access) or wait for him to shed light on some yet dark areas :-). As another alternative, after a talk with Wilba, he told me, that it is possible to alter the MB6582 to use 8 display data lines - in that case, I´d expect the "garbage" display driver to work - ask Wilba for moar info. Why and how that works, is out of my understanding though (aren´t those 4 lines used anywhere else on the MB6582?). Wilba, did you manage to get your OLED up and running (the Electronic Assembly one)? Greets, Peter Edited August 8, 2011 by Hawkeye Quote
Altitude Posted August 10, 2011 Author Report Posted August 10, 2011 so how does one go about using a custom LCD driver? Quote
Hawkeye Posted August 10, 2011 Report Posted August 10, 2011 (edited) Hope I didn´t miss anything: a) checkout - use subversion to checkout the latest mios8 sources b) toolchain - manage to compile your own midibox sid -> and test upload mb6582.hex to your first core. c) replace app_lcd.inc in mb6582 directory with your new version (e.g. the downloaded one from my thread) d) adjust main.inc to use custom display type 7, i think. e) adjust makefile to include app_lcd .inc f) test with garbage instructions in new app_lcd.inc, if it is compiled (compiler should be annoyed) g) adjust initialization code in app_lcd.inc h) compile new version i) upload to first core Edited August 10, 2011 by Hawkeye 1 Quote
Altitude Posted March 6, 2012 Author Report Posted March 6, 2012 (edited) Ok, I am back on this. I tried Hawkeye's VFD driver and unless I am doing something wrong when making the hex, it does not seem to work (black screen) I simply replaced the app_lcd.inc file in the SRC folder and built the app. I did verify it was reading the file like suggested above by just putting garbage in the file. Any steps I missed here? I could not find where to set the custom LCD in the main.inc. I did not include that file in the makefile either. If anyone would like to point out any errors in my ways here, please feel free since I am clueless on how to perform steps d-g above. After some searching, I did find this site which addresses the initialization commands for my specific display: http://www.elcojacobs.com/controlling-an-oled-character-display-with-arduino/ its for arduino, but I figured someone who understands the commands might find it useful. Edited March 6, 2012 by Altitude Quote
jojjelito Posted March 6, 2012 Report Posted March 6, 2012 Hiya! Hawkeye's VFD driver does some 4bit magic. I tweaked it to use a more Newhaven-centric display init in the main SID app, but I missed out on the fact that there's display init also done in the bootloader! I assume you use the Newhaven 4x20 OLED . Currently I'm tied up with my modular, but it would be fun to get this display business done. Maybe the Newhaven requires less tweaking if we re-jig it to use 8 bits instead. I remember looking the display PCB and the PDF and shaking my head, at the time I trouble correlating the actual board with what is described in the manual... Better look again. /J Quote
Altitude Posted March 6, 2012 Author Report Posted March 6, 2012 Well, let me put a bounty on it then: I have an extra green 4x20 to anyone who helps get this up an running. They are great displays and reasonably priced Quote
jojjelito Posted March 7, 2012 Report Posted March 7, 2012 I need to refresh my memory, but here's from my app_led.inc from when I was on it. Not sure if it's the latest, we need to cross-check this against the data sheet again: USER_LCD_Init ;; notify that no graphical LCD is connected bcf MIOS_BOX_CFG0, MIOS_BOX_CFG0_USE_GLCD ; (Initialization of Ports: done in Init_Ports) SET_BSR USER_LCD_STATUS clrf USER_LCD_STATUS, BANKED movlw 100 ; 100 ms delay call MIOS_Delay bcf USER_LCD_LAT_RW, USER_LCD_PIN_RW ; LCD_WRITE bcf USER_LCD_LAT_RS, USER_LCD_PIN_RS ; USER_LCD_PIN_RS_0 ;; initialize LCD movlw 0x3 movwf USER_LCD_LAT_D rcall USER_LCD_Strobe_Set movlw 10 ; 10 ms delay call MIOS_Delay rcall USER_LCD_Strobe_Clr movlw 10 ; 10 ms delay call MIOS_Delay movlw 0x3 movwf USER_LCD_LAT_D rcall USER_LCD_Strobe_Set movlw 10 ; 10 ms delay call MIOS_Delay rcall USER_LCD_Strobe_Clr movlw 10 ; 10 ms delay call MIOS_Delay movlw 0x3 movwf USER_LCD_LAT_D rcall USER_LCD_Strobe_Set movlw 10 ; 10 ms delay call MIOS_Delay rcall USER_LCD_Strobe_Clr movlw 10 ; 10 ms delay call MIOS_Delay movlw 0x2 movwf USER_LCD_LAT_D rcall USER_LCD_Strobe_Set movlw 10 ; 10 ms delay call MIOS_Delay rcall USER_LCD_Strobe_Clr movlw 10 ; 10 ms delay call MIOS_Delay movlw 50 ; 50 ms delay call MIOS_Delay movlw 0x2B ; Function set rcall USER_LCD_Cmd movlw 0x08 ; Display Off rcall USER_LCD_Cmd movlw 0x01 ; Display Clear rcall USER_LCD_Cmd movlw 0x06 ; Entry Mode Set to Auto Increment rcall USER_LCD_Cmd movlw 0x02 ; Home Command rcall USER_LCD_Cmd movlw 0x0C ; Display ON rcall USER_LCD_Cmd movlw 0x00 ; set cursor to zero pos rgoto USER_LCD_CursorSet Quote
Altitude Posted March 7, 2012 Author Report Posted March 7, 2012 one thing I noticed looking at the guy who ran in on the arduino was that all his delays we much longer than your values, maybe thats the issue? I like the run in 8 bit mode idea though.. The MB6582 board is provisioned for it but I'll need to dig through the documentation and see if I can figure it out since I dont know anyone who's done it Quote
jojjelito Posted March 7, 2012 Report Posted March 7, 2012 Ahh. Think I got my delays from the datasheet, but that don't mean that they suffice I wonder if it's not easier to grok how to modify the OLED board jumpers to make it run in a more sane 8-bits? If we're lucky we don't have to mess around with the init that much if it's similar enough to a HD44780... Quote
Altitude Posted March 7, 2012 Author Report Posted March 7, 2012 (edited) Where are the jumpers? Am I missing something that obvious? It should be perfectly compatible with the HD44780, I use the 16x2 ones in the shruthis i build and they work perfectly without any modification, its just a drop in for the LED backlit ones Edited March 7, 2012 by Altitude Quote
Hawkeye Posted March 7, 2012 Report Posted March 7, 2012 Had a nice talk with Wilba about that last year - you can reconfigure/bridge the MB6582 baseboard to allow 8-bit display connectivity - then (he said) the OLED might work right out of the box - how it is done, he must explain to you (would be nice to document it somewhere :). Many greets! Peter Quote
Altitude Posted March 7, 2012 Author Report Posted March 7, 2012 I'm not building the custom driver in right. nILS is putting the smack down on me right now so I should be able to proper test your driver tonight. Quote
jojjelito Posted March 7, 2012 Report Posted March 7, 2012 Oh, cool! I'm not 100% sure this was my latest or greatest, I found it in a working directory in my lab PC at work. It looked familiar enough, but it's possible I went ahead and changed more stuff in my compile/source dir. I'll take a gander at this vs the data sheet later tonight. Quote
Altitude Posted March 7, 2012 Author Report Posted March 7, 2012 nope, I did it right :( just doesnt work. I'll play around some more with this tonight. nILS does not seem keen on the 8bit mode though.. Quote
jojjelito Posted March 7, 2012 Report Posted March 7, 2012 (edited) Sheesh! The code I posted is deffo something unfinished: I looked at pp21 in the Newhaven datasheet: For 4bit display init, I think that all the funky business with movlw 0x3 movwf USER_LCD_LAT_D rcall USER_LCD_Strobe_Set movlw 10 ; 10 ms delay call MIOS_Delay rcall USER_LCD_Strobe_Clr movlw 10 ; 10 ms delay call MIOS_Delay plus the 50ms wait need to go away. The datasheet starts with Power on. Wait more than 1ms for power stablization. I dunno why all those other delays are there in the code, need to check with Hawkeye. Then we should send function set where: [Function Set: RS R/W DB7 DB6 DB5 DB4 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 X X And then do some waiting for the busy flag. Then on to display off. Busy flag wait. Display clear. Wait for busy flag. Entry mode set. Wait for busy flag. Home command. Wait for busy flag. Display on. Let there be light! Edited March 7, 2012 by jojjelito Quote
Altitude Posted March 7, 2012 Author Report Posted March 7, 2012 tell me what to code into the app_lcd.inc and i'll give it a try when i get home Quote
jojjelito Posted March 7, 2012 Report Posted March 7, 2012 I'll try to e-mail you the entire thing when I'm back at work tomorrow. Basically all the init business is below the wait 50ms code in the above example. I'm not sure about all the waiting around before that though. We should double-check the values I set, and make sure that Hawkeye's USER_LCD_Cmd does it's thing correctly (i.e send 2x4bits plus wait for the busy flag). /J Quote
Schrabikus Posted October 27, 2013 Report Posted October 27, 2013 (edited) Tried this OLED with MBSID. With default driver it reboots after "Launching CS" message and characters looks like shifted 1 pixel. There's 8-bit demo code with initialization example. void LCD_initialize(void) { RES=0; Delay(200); RES=1; Delay(200); Write_Command(0x2a); //RE=1 Write_Command(0x71); //Function Selection A Write_Data(0x00); //Disable internal VDD Write_Command(0x28); //RE=0,IS=0 Write_Command(0x08); //display OFF Write_Command(0x2a); //RE=1 Write_Command(0x79); //SD=1 OLED command set is enabled Write_Command(0xD5); //Set Display Clock Divide Ratio/ Oscillator Frequency Write_Command(0x70); Write_Command(0x78); //SD=0 OLED command set is disabled Write_Command(0x08); //5-dot font width, black/white inverting of cursor disable, 1-line or 2-line display mode Write_Command(0x06); //COM0 -> COM31 SEG99 -> SEG0, Write_Command(0x72); //Function Selection B. Select the character no. of character generator Select character ROM Write_Data(0x01); //CGRAOM 248 COGRAM 8 Select ROM A Write_Command(0x2a); //RE=1 Write_Command(0x79); //SD=1 OLED command set is enabled Write_Command(0xDA); //Set SEG Pins Hardware Configuration Write_Command(0x10); //Alternative (odd/even) SEG pin configuration, Disable SEG Left/Right remap Write_Command(0xDC); //Function Selection C Set VSL & GPIO Write_Command(0x00); //Internal VSL represents GPIO pin HiZ, input disabled (always read as low) Write_Command(0x81); //Set Contrast Control Write_Command(0x8F); Write_Command(0xD9); //Set Phase Length Write_Command(0xF1); Write_Command(0xDB); //Set VCOMH Deselect Level ( Write_Command(0x30); //0.83 x VCC Write_Command(0x78); //SD=0 OLED command set is disabled Write_Command(0x28); //RE=0,IS=0 Write_Command(0x01); //Clear Display Write_Command(0x80); //Set DDRAM Address Delay(1000); Write_Command(0x0C); //Display ON Write_CGRAM(font); } I tried with 8-bit connection (OLED's jumpers allows to switch interface modes) and edited clcs/app_lcd.inc so it's initialisation part look like this: ;; initialize LCD movlw 0x2a ; rcall USER_LCD_Cmd movlw 0x71 ; rcall USER_LCD_Cmd movlw 0x0 movwf USER_LCD_LAT_D rcall USER_LCD_Strobe_Set rcall USER_LCD_Strobe_Clr movlw 50 ; 50 ms delay call MIOS_Delay rcall USER_LCD_Strobe_Set rcall USER_LCD_Strobe_Clr movlw 50 ; 50 ms delay call MIOS_Delay rcall USER_LCD_Strobe_Set rcall USER_LCD_Strobe_Clr movlw 0x28 ; rcall USER_LCD_Cmd movlw 0x08 ; rcall USER_LCD_Cmd movlw 0x2a ; rcall USER_LCD_Cmd movlw 0x79 ; rcall USER_LCD_Cmd movlw 0xD5 ; rcall USER_LCD_Cmd movlw 0x70 ; rcall USER_LCD_Cmd movlw 0x78 ; rcall USER_LCD_Cmd movlw 0x08 ; rcall USER_LCD_Cmd movlw 0x06 ; rcall USER_LCD_Cmd movlw 0x72 ; rcall USER_LCD_Cmd movlw 0x0 movwf USER_LCD_LAT_D rcall USER_LCD_Strobe_Set movlw 10 ; 10 ms delay call MIOS_Delay rcall USER_LCD_Strobe_Clr movlw 10 ; 10 ms delay call MIOS_Delay movlw 0x2a ; rcall USER_LCD_Cmd movlw 0x79 ; rcall USER_LCD_Cmd movlw 0xDA ; rcall USER_LCD_Cmd movlw 0x10 ; rcall USER_LCD_Cmd movlw 0xDC ; rcall USER_LCD_Cmd movlw 0x00 ; rcall USER_LCD_Cmd movlw 0x81 ; rcall USER_LCD_Cmd movlw 0x8F ; rcall USER_LCD_Cmd movlw 0xD9 ; rcall USER_LCD_Cmd movlw 0xF1 ; rcall USER_LCD_Cmd movlw 0xDB ; rcall USER_LCD_Cmd movlw 0x30 ; rcall USER_LCD_Cmd movlw 0x78 ; rcall USER_LCD_Cmd movlw 0x28 ; rcall USER_LCD_Cmd movlw 0x01 ; Clear Display call USER_LCD_Cmd bcf MIOS_LCD_TIMEOUT1, 7, BANKED ; everything ok, make sure that LCD_TIMEOUT, bit 7 is cleared movlw 0x80 ; without these lines the LCD will not work rcall USER_LCD_Cmd ; correctly after a second USER_LCD_Init movlw 100 ; 100 ms delay call MIOS_Delay movlw 0x0c rcall USER_LCD_Cmd movlw 0x00 ; set cursor to zero pos rgoto USER_LCD_CursorSet - initialization ok, works with lcd7 example, characters ok, but when i compile MBSID with this driver - moving garbage on screen. Than I tried to add initialisation sequence from demo code to Hawkeyes app_lcd.inc but no luck in 4-bit mode. Black screen with no signs of life. Was my attempt correct and what should i try next? Jojjelito, you say that there can be problems with USER_LCD_Cmd, could it be the cause of 4-bit mode fail? Edited October 28, 2013 by Schrabikus Quote
Altitude Posted October 28, 2013 Author Report Posted October 28, 2013 I dont know what it is with OLEDs in 4 bit mode, I looked at this a while back with the 4x20 Newhaven part and had no luck either.. Quote
Schrabikus Posted October 28, 2013 Report Posted October 28, 2013 As far as I understand garbage on screen in 8-bit mode caused by CAN interface on D3 pin. Maybe there's a way to connect display to MBSID in 8-bit mode? Quote
Altitude Posted October 28, 2013 Author Report Posted October 28, 2013 (edited) based on what nILS said, it can be done but would need to major rework of the firmware since an extra pin would be needed to take the place of the one used for the CAN interface. If I spoke better C, id do it since a 4x20 OLED for the MBSID would be really nice.. Edited October 28, 2013 by Altitude Quote
Schrabikus Posted October 28, 2013 Report Posted October 28, 2013 Little progress! Found this: http://www.midibox.org/dokuwiki/doku.php?id=wilba_mb_6582 you can run in 8-bit mode by using two PIC pins from port E to replace the two PIC pins being used by the CAN bus. Solder those jumper pads on the bottom side, run the change device ID app to use custom LCD driver, the custom LCD driver file should already be in the source code of the MB-SID V2 application and compiled in. If you want to run other applications, you'll need to copy that custom LCD driver file into those source directories and rebuild those applications. Reconnected D2, D3 OLED lines to J5 pins 1,2 according to mb6582 PCB added my custom init sequence to app_lcd.inc in midibox_sid_v2/src (it's USER_LCD_Data and USER_LCD_Cmd functions stores bits 3:2 into port E bits 2:1) Now it loads, with some special character bugs and reboot every 30 seconds (can't figure out what causes it) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.