Changes between Version 7 and Version 8 of epics/bbb/debian/thermometer/ft260


Ignore:
Timestamp:
09/07/17 16:53:09 (7 years ago)
Author:
michkawa
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • epics/bbb/debian/thermometer/ft260

    v7 v8  
    406406 
    407407# Read ADT7410 templature value 
    408 getTemp { 
     408getTempReg { 
    409409    out $rd   $1   $flg    $len 0x00; 
    410     in  $wr_4 $len "%(\$2)01r" "%01r" "%*4r"; 
     410    in  $wr_4 $len "%2r" "%*4r"; 
    411411} 
    412412 
     
    425425} 
    426426 
    427 record(longin, "$(user):temp:reg:HSB") 
     427record(longin, "$(user):temp:reg") 
    428428{ 
    429     field(DESC, "Get temperature registor HSB") 
    430 } 
    431  
    432 record(longin, "$(user):temp:reg:LSB") 
    433 { 
    434     field(DESC, "Get temperature registor LSB") 
     429    field(DESC, "Get temperature raw registor") 
    435430    field(DTYP, "stream") 
    436     field(INP,  "@FT260_ADT7410.proto getTemp($(i2caddr),$(user):temp:reg:HSB) $(dev)") 
     431    field(INP,  "@FT260_ADT7410.proto getTempReg($(i2caddr)) $(dev)") 
    437432    field(SCAN, "$(scan)") 
    438433    field(FLNK, "$(user):temp") 
    439434} 
    440435 
    441  
    442436record(calc, "$(user):temp") 
    443437{ 
    444438    field(DESC, "Get temperature") 
    445     field(INPA, "$(user):temp:reg:LSB") 
    446     field(INPB, "$(user):temp:reg:HSB") 
    447     field(CALC,  "(B&0x80)=0x80?(((B<<8)|A)-65536)/128:((B<<8)|A)/128") 
     439    field(INPA, "$(user):temp:reg") 
     440    field(CALC,  "(A&0x8000)=0x8000?(A-65536)/128:A/128") 
    448441    field(PREC,  "5") 
    449442    field(EGU,   "degC") 
     
    451444}}} 
    452445 
    453  
    454  
     446== 問題発生 == 
     447 
     448しばらく動かして値をcamonitorしていると、あるタイミングで止まってしまう。[[br]] 
     449camonitorだけではわからず、IOCのasynログを出力してみると、温度レジスタのLSBに0x00が入った時以降、データが出力されなくなっていることが判明した。[[br]] 
     450 
     451 
     452{{{ 
     4532017/09/07 07:20:18.514 HID1 write 5 
     454ツH 
     455\302H\006\004\000 
     456 
     457c2 48 06 04 00 
     4582017/09/07 07:20:18.517 HID1 write(raw) 65 
     459ツH 
     460\302H\006\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000 
     461 
     462c2 48 06 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
     46300 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
     46400 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
     46500 00 00 00 00 
     4662017/09/07 07:20:18.544 HID1: wrote 5 bytes to 403:6030:FT27KQDF, return asynSuccess 
     4672017/09/07 07:20:18.545 HID1 addr -1 queueRequest priority 0 from lockHolder 
     4682017/09/07 07:20:18.546 HID1 schedule queueRequest timeout 
     4692017/09/07 07:20:18.548 asynManager::portThread port=HID1 callback 
     4702017/09/07 07:20:18.549 HID1: read 8 bytes from 403:6030:FT27KQDF, return asynSuccess 
     4712017/09/07 07:20:18.551 HID1 read(raw) 8 
     472 
     473 
     474\320\004\016\n\200\200\000\000 
     475 
     476d0 04 0e 0a 80 80 00 00 
     4772017/09/07 07:20:19.500 HID1 addr -1 queueRequest priority 0 not lockHolder 
     4782017/09/07 07:20:19.501 HID1 schedule queueRequest timeout 
     4792017/09/07 07:20:19.502 asynManager::portThread port=HID1 callback 
     4802017/09/07 07:20:19.503 HID1 addr -1 queueRequest priority 0 not lockHolder 
     4812017/09/07 07:20:19.505 HID1 schedule queueRequest timeout 
     4822017/09/07 07:20:19.506 asynManager::portThread port=HID1 callback 
     4832017/09/07 07:20:19.506 HID1: read 0 bytes from 403:6030:FT27KQDF, return asynSuccess 
     4842017/09/07 07:20:19.507 HID1 read(raw) 0 
     485 
     4862017/09/07 07:20:19.508 HID1 write 5 
     487ツH 
     488\302H\006\004\000 
     489 
     490c2 48 06 04 00 
     4912017/09/07 07:20:19.510 HID1 write(raw) 65 
     492ツH 
     493\302H\006\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000 
     494 
     495c2 48 06 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
     49600 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
     49700 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
     49800 00 00 00 00 
     4992017/09/07 07:20:19.527 HID1: wrote 5 bytes to 403:6030:FT27KQDF, return asynSuccess 
     5002017/09/07 07:20:19.529 HID1 addr -1 queueRequest priority 0 from lockHolder 
     5012017/09/07 07:20:19.529 HID1 schedule queueRequest timeout 
     5022017/09/07 07:20:19.529 asynManager::portThread port=HID1 callback 
     5032017/09/07 07:20:19.530 HID1: read 8 bytes from 403:6030:FT27KQDF, return asynSuccess 
     5042017/09/07 07:20:19.531 HID1 read(raw) 8 
     505 
     506\320\004\016\000\200\200\000\000 
     507 
     508d0 04 0e 00 80 80 00 00 
     5092017/09/07 07:20:20.501 HID1 addr -1 queueRequest priority 0 not lockHolder 
     5102017/09/07 07:20:20.503 HID1 schedule queueRequest timeout 
     5112017/09/07 07:20:20.505 asynManager::portThread port=HID1 callback 
     5122017/09/07 07:20:20.506 HID1 addr -1 queueRequest priority 0 not lockHolder 
     5132017/09/07 07:20:20.507 HID1 schedule queueRequest timeout 
     5142017/09/07 07:20:20.508 asynManager::portThread port=HID1 callback 
     5152017/09/07 07:20:20.509 HID1: read 0 bytes from 403:6030:FT27KQDF, return asynSuccess 
     5162017/09/07 07:20:20.511 HID1 read(raw) 0 
     517 
     5182017/09/07 07:20:20.511 HID1 write 5 
     519ツH 
     520\302H\006\004\000 
     521 
     522c2 48 06 04 00 
     5232017/09/07 07:20:20.513 HID1 write(raw) 65 
     524ツH 
     525\302H\006\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000 
     526 
     527c2 48 06 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
     52800 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
     52900 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
     53000 00 00 00 00 
     5312017/09/07 07:20:20.529 HID1: wrote 5 bytes to 403:6030:FT27KQDF, return asynSuccess 
     5322017/09/07 07:20:20.530 HID1 addr -1 queueRequest priority 0 from lockHolder 
     5332017/09/07 07:20:20.531 HID1 schedule queueRequest timeout 
     5342017/09/07 07:20:20.531 asynManager::portThread port=HID1 callback 
     5352017/09/07 07:20:22.535 HID1: read 0 bytes from 403:6030:FT27KQDF, return asynSuccess 
     5362017/09/07 07:20:22.535 HID1 read(raw) 0 
     537 
     5382017/09/07 07:20:24.538 HID1: read 0 bytes from 403:6030:FT27KQDF, return asynSuccess 
     5392017/09/07 07:20:24.538 HID1 read(raw) 0 
     540 
     5412017/09/07 07:20:26.541 HID1: read 0 bytes from 403:6030:FT27KQDF, return asynSuccess 
     5422017/09/07 07:20:26.541 HID1 read(raw) 0 
     543 
     544}}} 
     545 
     546この状態になると、IOCを止めるだけではダメで、USBコネクタを挿抜して再認識させないと復活しない。[[br]] 
     547 
     548始めは、HIDAPIの方の問題かと考え、pythonでテストプログラムを書いて実行してみたが、LSBが0x00になっても止まることはなかった。[[br]] 
     549その時のスクリプトがこれ。[[br]] 
     550 
     551{{{ 
     552import hid 
     553import time 
     554import logging 
     555 
     556h = hid.device() 
     557h.open(0x0403, 0x6030, u"FT27KQDF") 
     558h.set_nonblocking(1) 
     559 
     560logging.basicConfig(format='[%(asctime)s]: %(message)s', 
     561                    level=logging.DEBUG) 
     562h.write([0xD0, 0x48, 0x06, 0x02, 0x03,0x80,0x00,0x00]) 
     563 
     564while True: 
     565    try: 
     566        wr = h.write([0xC2, 0x48, 0x06, 0x04, 0x00]) 
     567        logging.debug("[W]" + str(wr)) 
     568 
     569        rd = h.read(64) 
     570        logging.debug("[R]" + str(rd)) 
     571        time.sleep(1) 
     572    except: 
     573        break 
     574 
     575h.close() 
     576}}} 
     577 
     578asynかstreamdeviceのどちらかの問題の可能性が高いが、詳細は追っていないので現時点では原因は不明。