Month: November 2018

How to use a JLX1602G-390 display with NuttX

I just created a driver for NuttX to use JLX1602G-390 display.

This display is based on Siatronix ST7032i the I2C version.

First you need to wire it connecting an external capacitor and a resistor as explained on this schematic:

I am using the STM32F4Discovery board with this display connecting pins PB6 to SCL and PB9 to SDA. These pins are configured to enable an internal pull-up resistor, but case your microcontroller doesn’t have it, you need to connect external pull-up 4k7 resistors to SCL and SDA pins.

After configuring the NuttX to use this display, you can execute the slcd command from NuttShell:

nsh> slcd
Opening /dev/disp0 for read/write access
Attributes:
  rows: 2 columns: 16 nbars: 0
  max contrast: 0 max brightness: 1
Clear screen
WRITING:
0000: 1b5b46                                                            .[F 
Set brightness to 1
Print [Hello World NuttX]
WRITING:
0000: 48656c6c6f20576f726c64204e757474 58                               Hello World Nutt X
Test complete
nsh> 

You can see the step-by-step video tutorial here:

Source of this schematic: https://bitbucket.org/ospringauf/mecanumrover/wiki/JLX1602G-390

Sheding some (infrared) light on MLX90614

After implementing the MLX90614 driver for NuttX I noticed that although the write command to change the device I2C address in the EEPROM was reporting success, after the power cycle the new address was not working. Worst: even the previous address was not working.

Basically the device appears damaged and didn’t respond to any I2C command.

Then doing my research I discovered a Melexis document about SMBus communication:

https://www.pololu.com/file/0J171/MLX90614_SMBus.pdf

In this document I noticed they are using the address 0x00 instead of the default 0x5a address. After modifying the driver to use the 0x00 address the device accepted the new command.

There are many discussing about this subject on Arduino and similar forum:

https://chrisramsay.co.uk/posts/2014/09/arduino-and-multiple-mlx90614-sensors/
http://forum.arduino.cc/index.php?topic=54170.msg539601#msg539601
https://forum.mikroe.com/viewtopic.php?f=178&t=67842
http://wiki.wiring.co/wiki/Connecting_Infrared_Thermometer_MLX90614_to_Wiring

Note that someone discovered that using a brute force CRC approach eventually will work and everybody decided to copy it. Too bad guys!

The MLX90614 uses CRC8-CCITT standard to check if data are correct, so any CRC8-CCITT implementation will work, for example this one: https://3dbrew.org/wiki/CRC-8-CCITT

Now on NuttX you can call the mlx90614 example application to change the device’s I2C address this way: (changing from default 0x5a to 0x3a)

nsh> mlx90614 0x3a
Address 0x3a stored on your device!
Please do a power cycle and update the I2C board address!
nsh>