Author Topic: NHD-C160100DiZ and Raspberry Pi  (Read 4697 times)

tinkerer1359

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
    • View Profile
NHD-C160100DiZ and Raspberry Pi
« on: March 13, 2015, 09:21:09 AM »
Hi-

I've been trying to add a NHD-C160100DiZ to my Raspberry Pi. I have interfaced the display using I2C with CSB tied low and RST tied high (always selected, not reset). The I2C bus detect finds the address (0x3F). Using the following program (which I hope is a faithful adaptation of the example code), I get nothing on the screen:
Code: [Select]
import time
import smbus

bus = smbus.SMBus(1)        # Bus declaration

#=============================================================================
# I2C
#   I2C communication class
#     I2C.write(Dev, Length, Reg, Val)  - writes to a device via I2C
#     I2C.read(Dev, Length, Reg)        - reads from a device via I2C
#
#     Dev - Device I2C address, Length - "Block"|"Word"|"Byte"|"None"
#     Reg - Register address for device, Val - Value to be set in the Dev/Reg
#     http://erazor-zone.de/wiki:linux:python:smbus:doc
#     https://www.kernel.org/doc/Documentation/i2c/smbus-protocol
#=============================================================================
class I2C(object):
  """I2C Communication Class"""
#-----------------------------------------------------------------------------
# I2C.write
  def write(self, Dev, Length, Reg, Val):
    if Length == "Block":           #     Block - uses addressed reg, array
      bus.write_block_data(Dev, Reg, Val)
    elif Length == "Word":          #     Word  - uses addressed reg, 16-bit
      bus.write_word_data(Dev, Reg, Val)
    elif Length == "Byte":          #     Byte  - uses addressed reg, 8-bit
      bus.write_byte_data(Dev, Reg, Val)
    elif Length == "None":          #     None  - no addressed reg, 8-bit
      bus.write_quick(Dev)
    return -1
   
#-----------------------------------------------------------------------------
# I2C.read
  def read(self, Dev, Length, Reg):
    if Length == "Block":           #     Block - uses addressed reg, array
      value = bus.read_block_data(Dev, Reg)
    elif Length == "Word":          #     Word  - uses addressed reg, 16-bit
      value = bus.read_word_data(Dev, Reg)
    elif Length == "Byte":          #     Byte  - uses addressed reg, 8-bit
      value = bus.read_byte_data(Dev, Reg)
    elif Length == "None":          #     None  - no addressed reg, 8-bit
      value = bus.read_byte(Dev)
    return value

#=============================================================================
# Main

RC = [0 for x in range(13)]                     # Initializes RC
I = I2C()
Adr = 0x3F
Com = 0x00
Dat = 0x40

I.write(Adr, "Block", Com, [0xE2])

I.write(Adr, "Block", Com, [0x48, 0x64, 0xA0, 0xC8, 0x44, 0x00, 0xAB, 0x26, 0x81, 0x15, 0x56, 0x64])

time.sleep(2)

I.write(Adr, "Block", Com, [0x2C, 0x66])

time.sleep(2)

I.write(Adr, "Block", Com, [0x2E])

time.sleep(2)

I.write(Adr, "Block", Com, [0x2F, 0xF3, 0x00, 0x96, 0x38, 0x75, 0x97])

i = 0
j = 0
gs = [0x00, 0x06, 0x0B, 0x10, 0x15, 0x1A, 0x1E, 0x23, 0x27, 0x2B, 0x2F, 0x32, 0x35, 0x38, 0x3A, 0x3C]
for x in range(0x80, 0xC0):
  i = i + 1
  # print("%02X %02X %02X %02X" % (Adr, Com, x, gs[j]))
  I.write(0x3F, "Block", Com, [x, gs[j]])
  if (i % 4) == 0:
    j = j + 1

I.write(Adr, "Block", Com, [0x38, 0x74, 0xAF])

I.write(Adr, "Block", Dat, [0x26, 0x26, 0x26, 0x26, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x31, 0x31, 0x31, 0x31])

Can anyone please direct me on how to resolve this?

Thanks!

SpiralP

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: NHD-C160100DiZ and Raspberry Pi
« Reply #1 on: March 13, 2015, 11:41:08 AM »
I've done alot of I2C stuff with other microprocessors and i have an idea for you to try.

The slave address they provide within the datasheet is 0x3F, which i see you define in your code.

The way I2C works is the Address is 7 bits. However it is left shifted by 1 bit.
So the total address is an 8 bit value.
The 7 most significant bits are the address of the device and the Least significant bit (0) is the Read / Write bit which tells the slave device if you're going to be sending it data or trying to retrieve data from it.

You might want to try left shifting the address by 1 bit and setting that in your code as the slave address.
Hence 0x3F will be 0x7E


tinkerer1359

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
    • View Profile
Re: NHD-C160100DiZ and Raspberry Pi
« Reply #2 on: March 13, 2015, 12:08:22 PM »
Thanks for the reply. I had already thought of that, and have checked and verified the I2C address using the detect command on the RPi. Also, the I2C commands throw an error if the address is invalid, so I'm fairly confident that I have communication.

Paul_B

  • Administrator
  • Sr. Member
  • *****
  • Posts: 248
  • Karma: 16
    • View Profile
Re: NHD-C160100DiZ and Raspberry Pi
« Reply #3 on: March 16, 2015, 09:37:34 AM »
Hello,

Sounds like your I2C connection is correct, this tells me there must be an issue in your initialization.  Can you please share your initialization code?

Thanks!

tinkerer1359

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
    • View Profile
Re: NHD-C160100DiZ and Raspberry Pi
« Reply #4 on: March 17, 2015, 08:00:21 AM »
Hi-

The entire code is included above.

I may have found the issue: the RPi uses a 1.8k pull-up on its lines, which may be too severe. I am experimenting with removing the 1.8k and using 10k. I'll post the results when I determine them.

Paul_B

  • Administrator
  • Sr. Member
  • *****
  • Posts: 248
  • Karma: 16
    • View Profile
Re: NHD-C160100DiZ and Raspberry Pi
« Reply #5 on: March 17, 2015, 08:23:39 AM »
Hello,

Thanks for the update, I went ahead and looked over your initialization sequence and everything seems to be in order. It is possible that the RPi's 1.8k pull -up resistors could be causing a weak pull-up.

Looking forward to the results of your test  :)


tinkerer1359

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
    • View Profile
Re: NHD-C160100DiZ and Raspberry Pi
« Reply #6 on: March 18, 2015, 12:06:09 PM »
I just got a chance to play with the pull-ups. I have a RPi - B, and I'm using the I2C pins on the GPIO header, so removed R1 and R2, and terminated the I2C lines with 10k. The display finally responds!

Thanks to all who helped!

-Randy

Paul_B

  • Administrator
  • Sr. Member
  • *****
  • Posts: 248
  • Karma: 16
    • View Profile
Re: NHD-C160100DiZ and Raspberry Pi
« Reply #7 on: March 18, 2015, 12:46:38 PM »
Hello Randy,

Glad to hear you got it working, enjoy your display!


joel dey

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Re: NHD-C160100DiZ and Raspberry Pi
« Reply #8 on: August 21, 2017, 08:44:56 AM »
hello guys,
i need to know whether
1)Can lcd  be implemented with 100 kHtz?
2)Do supply current (Idd) need between 500 microA to 750microA to drive the lcd? since my supply voltage is 3.3 v but the current is less than 500microA?
3) As per the instructions i have connected the lcd and run the code, but i am not getting any display in lcd?in the setup i have used pull-up resistor as 10kohms and the capacitor is 1uF.
4) if there any other suggestions,please provide for NHD-C160100Diz.

Saurabh_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 341
  • Karma: 10
    • View Profile
Re: NHD-C160100DiZ and Raspberry Pi
« Reply #9 on: August 21, 2017, 02:12:30 PM »
Hello Joel,

1. Yes the display will work at 100khz
2. The supply current is dependent on what the display is showing and how far you are using the voltage booster, it can use up to 1 mA of current when fully powered.
3. This display does require 2 capacitors. can you tell me if you have both connected the way they are shown on page 4 of the datasheet?
4. You can find example code for this display here: NHD-C160100DiZ

joel dey

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Re: NHD-C160100DiZ and Raspberry Pi
« Reply #10 on: August 29, 2017, 01:59:41 AM »
hai  Saurabh_B,
thanks for the reply. i will give my point of observation, please help.
1) as per the data sheet in NHD-C160100 Diz-FSW-FBW, i have connected  two 10k pullup at (SCL, SDA both) and  five 1uF at Vout,V4,V3,V2,V1. I have made CSB low and RST high. the supply voltage is 3.3 V and measured  supply current is 200uA . so, my question is the supply current is enough to drive the lcd?
2) after running the code based on the previous post(http://www.newhavendisplay.com/app_notes/NHD-C160100DiZ.txt) given by you, i am getting the ACK from lcd after sending each byte,but it is not displaying any data to lcd. (i have checked all the bytes in logic analyser).

3) the NHD-C160100Diz-FSW-FBW used ST7528 controller , if you look at the page no 26 of the ST7528 datasheet(http://www.newhavendisplay.com/app_notes/ST7528.pdf). it mentioned on the NOTE that :"ST7528 IIC interface can not use with other slaver IIC device". The quotes i understand from it is that other slave device cant be used when using lcd display at I2C interface. Please give clarity on the statements or quotes ? and Can i use other slave devices at the same I2C interface when lcd is attached to it?

Saurabh_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 341
  • Karma: 10
    • View Profile
Re: NHD-C160100DiZ and Raspberry Pi
« Reply #11 on: August 29, 2017, 02:33:40 PM »
Joel,

The 200ľA does seem low. Would it be possible to tell me what the voltage measures at the VOUT pin?
The capacitors are part of a voltage boosting circuit which will generate the voltage required to drive the LCD, the current draw should increase after having sent the initialization sequence.

Can you tell me if you are sending any pixel data to the display after the initialization to see points on the graph?

Finally some slave devices do tend to clash with the lcd when use don the same I2C bus, I would recommend having the display working by itself first then adding more devices to the bus for final testing. If there is another device that uses the same slave address, the display will not work as intended.

 

Using Linux i2cdetect with NHD‐C0220BiZ‐FSW‐FBW on Raspberry Pi

Started by russkBoard Character LCDs

Replies: 9
Views: 5025
Last post August 21, 2017, 02:11:20 PM
by Saurabh_B
NHD-C160100DiZ-FSW-FBW - random pixel after init

Started by iz7crxBoard Graphic LCDs

Replies: 4
Views: 2147
Last post February 21, 2016, 02:25:55 AM
by iz7crx
NHD-C160100DiZ-FSW-FBW doesn't give an acknowledge

Started by 3DfxBoard Graphic LCDs

Replies: 0
Views: 501
Last post May 04, 2017, 03:10:24 PM
by 3Dfx
NHD-C160100DiZ-FSW-FBW 3D model and assembly

Started by evandro.bubiakBoard Graphic LCDs

Replies: 1
Views: 1831
Last post October 02, 2015, 08:36:39 AM
by Saurabh_B
OLED Replacement for NHD-C160100DiZ . . .

Started by lmitchamBoard OLEDs

Replies: 1
Views: 1386
Last post February 18, 2016, 08:15:27 AM
by Saurabh_B