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.

OPT3101EVM: OPT3101EVM works with Latte Software, but not when I try.

Part Number: OPT3101EVM
Other Parts Discussed in Thread: OPT3101

Hi,

When I run the Latte software with the OPT3101EVM connected, everything works correctly. I can see graphs on the screen and measure the distance to objects. 

Now when I send the same commands to the device using my own software, it reads the registers correctly it seems. 

I then issue the CAPS command, but nothing appears on COM4.

I used a COM PORT sniffer and when I use only the Latte, I receive data on COM4 correctly. 

Here are my register write and read settings:

DEVR
DEVR:0
REGRx56
REGRx56:0:000000
REGRxaf
REGRxaf:0:000000
REGRx14
REGRx14:0:000000
REGRx59
REGRx59:0:000000
REGRx07
REGRx07:0:000000
REGRx4c
REGRx4c:0:00F23E
REGRx90
REGRx90:0:002134
REGRx0a
REGRx0a:0:000000
REGRx83
REGRx83:0:0000D0
REGRx3d
REGRx3d:0:000000
REGRxb6
REGRxb6:0:000000
REGRxb9
REGRxb9:0:0001FF
REGRx53
REGRx53:0:000000
REGRxac
REGRxac:0:000000
REGRx11
REGRx11:0:003F18
REGRx46
REGRx46:0:000000
REGRx04
REGRx04:0:000017
REGRx49
REGRx49:0:000000
REGRx9d
REGRx9d:0:000000
REGRx37
REGRx37:0:000000
REGRx80
REGRx80:0:004E1E
REGRx3a
REGRx3a:0:4A0000
REGRx2d
REGRx2d:0:000000
REGRxa6
REGRxa6:0:000000
REGRx50
REGRx50:0:200100
REGRxa9
REGRxa9:0:000000
REGRx1e
REGRx1e:0:000000
REGRx43
REGRx43:0:000081
REGRx97
REGRx97:0:000000
REGRx01
REGRx01:0:120140
REGRx76
REGRx76:0:000000
REGRx34
REGRx34:0:000000
REGRx79
REGRx79:0:000001
REGRx27
REGRx27:0:26AC18
REGRxb0
REGRxb0:0:000000
REGRx2a
REGRx2a:0:784920
REGRxa3
REGRxa3:0:000000
REGRx5d
REGRx5d:0:000000
REGRx1b
REGRx1b:0:000000
REGRx40
REGRx40:0:2021E0
REGRx94
REGRx94:0:00FFFF
REGRx87
REGRx87:0:002454
REGRx31
REGRx31:0:000000
REGRx8a
REGRx8a:0:001F40
REGRx57
REGRx57:0:000000
REGRxa0
REGRxa0:0:002198
REGRx15
REGRx15:0:101063
REGRx5a
REGRx5a:0:000000
REGRx18
REGRx18:0:000000
REGRx4d
REGRx4d:0:001144
REGRx91
REGRx91:0:002134
REGRx0b
REGRx0b:0:0FC009
REGRx84
REGRx84:0:0000D8
REGRx3e
REGRx3e:0:000000
REGRxb7
REGRxb7:0:000000
REGRx54
REGRx54:0:000000
REGRxad
REGRxad:0:000000
REGRx47
REGRx47:0:800800
REGRx05
REGRx05:0:080000
REGRx4a
REGRx4a:0:000000
REGRx9e
REGRx9e:0:000000
REGRx08
REGRx08:0:000000
REGRx3b
REGRx3b:0:000000
REGRx60
REGRx60:0:000000
REGRxb4
REGRxb4:0:000000
REGRx2e
REGRx2e:0:8001A0
REGRxa7
REGRxa7:0:000000
REGRx51
REGRx51:0:000000
REGRxaa
REGRxaa:0:000000
REGRx44
REGRx44:0:000000
REGRx02
REGRx02:0:92A4C8
REGRx77
REGRx77:0:000000
REGRx35
REGRx35:0:000000
REGRx7a
REGRx7a:0:800000
REGRx38
REGRx38:0:000000
REGRx6d
REGRx6d:0:000000
REGRxb1
REGRxb1:0:000000
REGRx2b
REGRx2b:0:006000
REGRxa4
REGRxa4:0:000000
REGRx5e
REGRx5e:0:000000
REGRx1c
REGRx1c:0:000000
REGRx41
REGRx41:0:000010
REGRx0f
REGRx0f:0:144C4B
REGRx98
REGRx98:0:000000
REGRx32
REGRx32:0:000000
REGRx16
REGRx16:0:400100
REGRx5b
REGRx5b:0:000000
REGRx19
REGRx19:0:000000
REGRx4e
REGRx4e:0:00F881
REGRx92
REGRx92:0:002EE0
REGRx0c
REGRx0c:0:000000
REGRx71
REGRx71:0:000000
REGRx85
REGRx85:0:000020
REGRx3f
REGRx3f:0:000000
REGRx64
REGRx64:0:280C00
REGRx88
REGRx88:0:002648
REGRx55
REGRx55:0:000000
REGRxae
REGRxae:0:000000
REGRx13
REGRx13:0:000000
REGRx58
REGRx58:0:000000
REGRx4b
REGRx4b:0:000407
REGRx9f
REGRx9f:0:000000
REGRx09
REGRx09:0:000000
REGRx3c
REGRx3c:0:000000
REGRx61
REGRx61:0:000000
REGRxb5
REGRxb5:0:000000
REGRx2f
REGRx2f:0:000000
REGRxb8
REGRxb8:0:07FDFF
REGRx52
REGRx52:0:000000
REGRxab
REGRxab:0:000000
REGRx10
REGRx10:0:004000
REGRx45
REGRx45:0:000000
REGRx03
REGRx03:0:800000
REGRx48
REGRx48:0:000000
REGRx9c
REGRx9c:0:FFF000
REGRx36
REGRx36:0:000000
REGRx8f
REGRx8f:0:000000
REGRx39
REGRx39:0:000000
REGRx6e
REGRx6e:0:021CE2
REGRxb2
REGRxb2:0:000000
REGRx2c
REGRx2c:0:000800
REGRxa5
REGRxa5:0:000000
REGRx5f
REGRx5f:0:000000
REGRxa8
REGRxa8:0:000000
REGRx1d
REGRx1d:0:000000
REGRx42
REGRx42:0:000000
REGRx00
REGRx00:0:000000
REGRx99
REGRx99:0:000001
REGRx33
REGRx33:0:000000
REGRx78
REGRx78:0:000000
REGRx26
REGRx26:0:04000F
REGRx29
REGRx29:0:3F0FC3
REGRxa2
REGRxa2:0:000000
REGRx17
REGRx17:0:000000
REGRx5c
REGRx5c:0:000000
REGRx1a
REGRx1a:0:000000
REGRx93
REGRx93:0:000000
REGRx0d
REGRx0d:0:006000
REGRx72
REGRx72:0:0000C0
REGRx86
REGRx86:0:000028
REGRx30
REGRx30:0:000000
REGRx65
REGRx65:0:000000
REGRx89
REGRx89:0:0003E8
REGRx2a
REGRx2a:0:784920
REGRx08
REGRx08:0:000000
REGRx14
REGRx14:0:000000
REGRx14
REGRx14:0:000000
REGWx80x004e1e
REGWx80x004e1e:0
REGWx2ax784920
REGWx2ax784920:0
REGWx14x000000
REGWx14x000000:0
REGWx14x000000
REGWx14x000000:0
REGWx80x004e1f
REGWx80x004e1f:0
REGWx2ex8001a0
REGWx2ex8001a0:0
REGWx2ex8001b0
REGWx2ex8001b0:0
REGWx2ex8001a0
REGWx2ex8001a0:0
REGRx2e
REGRx2e:0:8001A0
REGWx2ex8001a0
REGWx2ex8001a0:0
REGRx3b
REGRx3b:0:FFFA54
REGRx3c
REGRx3c:0:0002D7
REGWx2ex8001a0
REGWx2ex8001a0:0
REGWx80x004e1e
REGWx80x004e1e:0
REGWx2ax784920
REGWx2ax784920:0
REGWx14x000000
REGWx14x000000:0
REGWx14x000000
REGWx14x000000:0
REGWx80x004e1f
REGWx80x004e1f:0
FLSX
FLSX:0:24
FLS!R
FLS!R:0
FLSR
FLSR:0:1080090B
REGRx0b
REGRx0b:0:108009
FLSR
FLSR:0:9900000C
REGRx0c
REGRx0c:0:990000
FLSR
FLSR:0:3F9C4129
REGRx29
REGRx29:0:3F9C41
FLSR
FLSR:0:0169782B
REGRx2b
REGRx2b:0:016978
FLSR
FLSR:0:00186A2C
REGRx2c
REGRx2c:0:00186A
FLSR
FLSR:0:52D5802D
REGRx2d
REGRx2d:0:52D580
FLSR
FLSR:0:2207A02E
REGRx2e
REGRx2e:0:2207A0
FLSR
FLSR:0:4913CF2F
REGRx2f
REGRx2f:0:4913CF
FLSR
FLSR:0:3005AC30
REGRx30
REGRx30:0:3005AC
FLSR
FLSR:0:001B3031
REGRx31
REGRx31:0:001B30
FLSR
FLSR:0:00038232
REGRx32
REGRx32:0:000382
FLSR
FLSR:0:00312933
REGRx33
REGRx33:0:003129
FLSR
FLSR:0:00FA5334
REGRx34
REGRx34:0:00FA53
FLSR
FLSR:0:006F9235
REGRx35
REGRx35:0:006F92
FLSR
FLSR:0:00EA1136
REGRx36
REGRx36:0:00EA11
FLSR
FLSR:0:00000038
REGRx38
REGRx38:0:000000
FLSR
FLSR:0:00000039
REGRx39
REGRx39:0:000000
FLSR
FLSR:0:4F00003A
REGRx3a
REGRx3a:0:4F0000
FLSR
FLSR:0:91001041
REGRx41
REGRx41:0:910010
FLSR
FLSR:0:00451C42
REGRx42
REGRx42:0:00451C
FLSR
FLSR:0:9E008343
REGRx43
REGRx43:0:9E0083
FLSR
FLSR:0:00056A45
REGRx45
REGRx45:0:00056A
FLSR
FLSR:0:9E090847
REGRx47
REGRx47:0:9E0908
FLSR
FLSR:0:9E090848
REGRx48
REGRx48:0:9E0908
FLSR
FLSR:0:9E090849
REGRx49
REGRx49:0:9E0908
FLSR
FLSR:0:003D7951
REGRx51
REGRx51:0:003D79
FLSR
FLSR:0:0033D652
REGRx52
REGRx52:0:0033D6
FLSR
FLSR:0:002BD153
REGRx53
REGRx53:0:002BD1
FLSR
FLSR:0:0000005E
REGRx5e
REGRx5e:0:000000
FLSR
FLSR:0:0000485F
REGRx5f
REGRx5f:0:000048
FLSR
FLSR:0:18000060
REGRx60
REGRx60:0:180000
FLSR
FLSR:0:00000071
REGRx71
REGRx71:0:000000
FLSR
FLSR:0:E1E1CEB4
REGRxb4
REGRxb4:0:E1E1CE
FLSR
FLSR:0:000001B5
REGRxb5
REGRxb5:0:000001
FLSR
FLSR:0:018026B8
REGRxb8
REGRxb8:0:018026
FLSR
FLSR:0:000478B9
REGRxb9
REGRxb9:0:000478
FLSR
FLSR:E
REGWx89x001b58
REGWx89x001b58:0
REGWx6ex0a1ce2
REGWx6ex0a1ce2:0
REGWx07x800000
REGWx07x800000:0
REGWx0dx806000
REGWx0dx806000:0
REGWx02x92a448
REGWx02x92a448:0
REGWx02xb2a448
REGWx02xb2a448:0
REGWx02x32a448
REGWx02x32a448:0
REGWx01x120140
REGWx01x120140:0
REGWx01x1a0140
REGWx01x1a0140:0
REGWx01x1a0140
REGWx01x1a0140:0
REGWx07x810000
REGWx07x810000:0
REGWx50x200101
REGWx50x200101:0
REGWx2ex2207a0
REGWx2ex2207a0:0
REGWx78x001000
REGWx78x001000:0
REGWx78x001080
REGWx78x001080:0
REGWx0bx108009
REGWx0bx108009:0
REGWx78x001080
REGWx78x001080:0
REGWx78x011080
REGWx78x011080:0
REGWx9fx000001
REGWx9fx000001:0
REGWx9fx001001
REGWx9fx001001:0
REGWx2ex9207a0
REGWx2ex9207a0:0
REGWx14x000000
REGWx14x000000:0
REGWx2bx016978
REGWx2bx016978:0
REGWx2cx001405
REGWx2cx001405:0
REGWx2ax78c920
REGWx2ax78c920:0
REGWxb9x000478
REGWxb9x000478:0
REGWxb9x000478
REGWxb9x000478:0
REGWx85x00267a
REGWx85x00267a:0
REGWx86x002682
REGWx86x002682:0
REGWx97x000001
REGWx97x000001:0
REGWx97x001001
REGWx97x001001:0
REGWx13x036b00
REGWx13x036b00:0
REGWx14x00101d
REGWx14x00101d:0
REGWx13x036b00
REGWx13x036b00:0
REGWx15x101108
REGWx15x101108:0
REGWx15xb02108
REGWx15xb02108:0
REGWx16x400100
REGWx16x400100:0
REGWx16xc00100
REGWx16xc00100:0
REGWx14x01101d
REGWx14x01101d:0
REGWx14x03101d
REGWx14x03101d:0
REGWx10x00c000
REGWx10x00c000:0
REGWx0fx154c4b
REGWx0fx154c4b:0
REGWx0fx954c4b
REGWx0fx954c4b:0
REGWx0fx914c4b
REGWx0fx914c4b:0
REGWx0fx915000
REGWx0fx915000:0
REGWx0fxd15000
REGWx0fxd15000:0
REGWx0fxf15000
REGWx0fxf15000:0
REGWx0fxf15000
REGWx0fxf15000:0
REGWx0fxf15000
REGWx0fxf15000:0
REGWx80x004e1f
REGWx80x004e1f:0
REGRx10
REGRx10:0:00C000
REGWx43x9e0083
REGWx43x9e0083:0
REGWx45x000566
REGWx45x000566:0
REGWx2dx52d57c
REGWx2dx52d57c:0
REGWx2dx52957c
REGWx2dx52957c:0
REGWx30x0005ac
REGWx30x0005ac:0
REGWx2fx4913cf
REGWx2fx4913cf:0
REGWx46x000000
REGWx46x000000:0
REGWx52x0033d6
REGWx52x0033d6:0
REGWx51x003d79
REGWx51x003d79:0
REGWx54x000000
REGWx54x000000:0
REGWx53x002bd1
REGWx53x002bd1:0
REGWx56x000000
REGWx56x000000:0
REGWx55x000000
REGWx55x000000:0
REGWxb5x000001
REGWxb5x000001:0
REGWx0cxa00000
REGWx0cxa00000:0
REGWxb4xe1e1ce
REGWxb4xe1e1ce:0
REGWxb4xe1e1ce
REGWxb4xe1e1ce:0
REGWxb4xe1e1ce
REGWxb4xe1e1ce:0
REGWxb8x01801b
REGWxb8x01801b:0
REGWxb8x01801b
REGWxb8x01801b:0
REGWxb9x000478
REGWxb9x000478:0
REGRx04
REGRx04:0:0A1317
REGRx0b
REGRx0b:0:108009

When I issue the CAPS command, nothing is received on COM4. 


CAPS
CAPS:0

So what am I doing wrong? It seems I'm overlooking something.

Regards,

Ray

  • Hi Ray,

    The EVM MSP430 uses 2 com ports. I have attached a document with details on the commands.

    Best,

    Alex

    8306.MSPComportCommandList.txt
    -----------------------------------------------------------------------------
    This document list the valid commands for the OPT3101EVMDC11 MSP Control port 
    -----------------------------------------------------------------------------
    
    COMPort settings :
    
    Control COM port: USB\VID_2047&PID_03FF&MI_00
    Data COM port   : USB\VID_2047&PID_03FF&MI_02
    
    Baudrate		: 9600
    Data			: 8 bits
    Parity			: None
    Stop			: 1 Bit
    Flow Control	: None
    
    List of valid Commands
    ----------------------
    
    The commands are case insensitive
    Commands are terminated by \r (Carriage return)
    Response code for each command is as follows 
    <command entered echoed>:<responsecode>:<response>
    <command entered echoed>	--> The command specified is echoed (expect \r)
    <responescode>				--> 0:Success. F:Command syntax error. E:Command systax correct but operation failed
    <response>					--> Response from operation. Eg: For register read request the read register values are displayed in HEX. 
    
    Register interface (all commands prefixed with REG):
    REGWx<Address>x<Data>\r		--> Performs register write to the register Address (in Hex) with data specified in <Data> (in Hex). Data format is [23:0]. For eg: REGWx1Ax1FBC03 writes data[23:0]=0x1FBC03 to register 0x1A
    REGRx<Address>\r			--> Performs register read from register Address (in Hex). Returns register data in format 1FBC03 where data[23:0]=0x1FBC03
    
    Device interface (all commands prefixed with DEV):
    DEVAx<Address>\r			--> Sets device I2C Slave address (in Hex format). Example device OPT3101 default address is 0x58 hence command to set this address will be DEVAx58
    DEVBx0\r					--> Sets I2C Continous mode capture register count to 9 registers 
    DEVBx1\r					--> Sets I2C Continous mode capture register count to 6 registers 
    DEVBx2\r					--> Sets I2C Continous mode capture register count to 12 registers mode (non-continous mode) 
    DEVR\r						--> Sends reset pulse to the device  
    
    Monoshot interface (all commands prefixed with MON):
    MONS\r						--> Start providing monoshot pulses from MSP to OPT3101 device 
    MONE\r						--> Stops providing monoshot pulses from MSP to OPT3101 device
    MONCx<MonoshotTime>			--> Sets monoshot interveral counter (in Hex). 1 count equals to 1.333us.Hence for eg: MONCxFFFF (maximum setting) will generate 1 monoshot pulse every 87.38ms 
    
    Flash interface (all commands prefixed with FLS):
    FLSSx<registerAddress>\r	--> Reads the contents of <registerAddress> in hex (though I2C) and stores the contents of the register to flash memory (non-volatile memory) and increments the writePointer of flash memory for next write command. 
    FLSX\r						--> Reads the contents of all the stored registers in flash memory (non-volatile memory) and writes the content to the device (through I2C transactions).
    FLSH\r						--> Reads the flash memory header and returns the number (in Hex) of entries (in terms of register count) stored in the flash memory (non-volatile memory). Actual number of bytes is register count * 4
    FLSR\r						--> Reads the flash memory contents from readPointer and return the hex value. Eg: If returned value is 3F124567 it means that the flash memory has stored vale of 0x3F1245 as contents of register 0x67. So when FLSX is executed among other entries in flash 0x67 register will be set to 0x3F1245 
    FLS!R\r						--> Resets read pointer of flash memory, so future FLSR would start from the first stored entry. 
    FLS!W\r						--> Resets write pointer of flash memory. This command erases all the contents of the Flash memory, including header.  
    FLSWx<Address>x<Data>\r		--> Writes the flash memory with register address (in Hex) followed by register data (in Hex). for eg: FLSWx54xAB1245 means that the flash contents will be updated with an entry for register addreee 0x54 with data[23:0]=0xAB1245. In future FLSR or FLSX would load the register 0x54 with the corresponding data[23:0] among other entries in the flash
    
    Capture interface (all commands prefixed with CAP):
    CAPS\r						--> Start Capture of data. Data port will start receiving captured data from the device.  
    CAPE\r						--> End Capture of data. Data port will stop receiving captured data from the device.
    CAPFx0\r					--> Sets capture format to binary format
    CAPFx1\r					--> Sets capture format to ascii/text/readable format
    

  • Hi Alex,

    Thanks for getting back to me. I had it on COM3 and COM4 and just made a mistake with the opening of COM4 in our software. Its working now. 

    What is the best way to calculate distance? The Amplitude signal seems to be the most stable and I get very nice smooth graphs like on the Latte software. But it seems on the datasheet the PHASE ANGLE must be used for distance, albeit very noisy. 

  • Hi Ray,

    Distance is calculated from phase. Amplitude indicates light reaching the device so does not correlate directly with distance. You can increase averaging on the device to decrease noise.

    Please see here for all our resources on OPT3101 https://e2e.ti.com/support/sensors/f/1023/t/815766

    Best,

    Alex

  • Hi Alex,

    Thanks for your help. I have it all working. Amplitude, Phase everything is working well. 

    I have been experimenting with various settings like the averaging etc..

    Trying to find the optimal settings for:

    Distance: 0mm to 60mm

    Sample rate: 330 to 500 samples/s

    I am using close range auto HDR.

    Its a great part, works very nicely.

  • Hi Alex,

    When I use Super HDR mode, it works very nicely. There is one small problem, the OPT3101 changes the setting and there is a small glitch on the graph. 

    Is there any way to eliminate this?   Here is a screenshot in Latte. 

    I have this working well in our application and it would be perfect if I could eliminate this switch over artifact. 

    The range we need to measure it 0mm to 60mm

    Best Regards,

    Ray

  • Hi Ray,

    You can freeze the mode to prevent switching. If you select a non-hdr mode it will stop switching, but you'd need to select the correct range and if target is too far then error will increase and if target is too close then the device can saturate.

    This jump is because LED current is switching to optimize the signal received. When the switch happens the amplitude goes to a higher level so any error due to lower amplitude can be corrected. 

    Best,

    Alex