Manual for sub_aap.exe

All about Sub-20 Multi Interface USB Adapter USB to I2C, SPI, GPIO, RS232, RS485, Ir, LCD

Moderator: serg

Post Reply
puneetkapoor
Posts: 4
Joined: Wed Dec 09, 2009 5:17 am

Manual for sub_aap.exe

Post by puneetkapoor »

Hi,

I need command manual for sub_app.exe, please provide as soon as possible.

Puneet

xol
Site Admin
Posts: 241
Joined: Sat Aug 29, 2009 8:04 am

Re: Manual for sub_aap.exe

Post by xol »

Hi,
YOu can currently use help output of sub_app:

Code: Select all

<10> ~/work/sub/sub20/app/sub_app.exe --help
-h, --help               Print this message and exit
    --version            Print version and exit
-c, --cmd=HEX,RESP_SZ    Send command HEX_STR and get response
    --i2c_stop           I2C Stop
    --i2c_start          I2C Start
-i, --i2c=xSA,xMA_SZ,xMA,dSZ,[HEX] I2C Read/Write
    --i2c_cfg=CONFIG     I2C config [f-freq|s-sa<VAL>]0-get
    --i2c_scan           I2C Scan
    --spi_cfg=SPI_CFG    Combination of e|s|p|t|r|f|l|m|1|2|4|8|5|6|7|g-get
    --ss=SSn,SSmode      SPI SS - [0..4],[h,h..l,hi,l,l..h,lo,hiz,0
    --spi=[I]dSZ,[HEX]   SPI Transfer. I-SDIO. Receive dSZ bytes, send HEX
    --gpio=FUNK,VAL,MASK GPIO operation <r|w|c>,value,mask
-r, --repeat=N_REPEAT    Repeat last operation
    --getsn              Get setial number
    --getid              Get product ID
    --getvpd             Get Configuration VPD
    --boot               Enter Bootloader Mode
    --fifo=dSZ[,HEX]     FIFO Read/Write
    --fifo_cfg=FIFO_CONF Combination of s-SPI|i-I2C|u-UATR|c-clear
    --LCD=LCD_STR        Write on LCD
    --rs_cfg=RS_CONFIG   RS Config <BAUD>_<SZ><PAR><STOP> like 9600_8N1 or 0
    --rs_tmg=RS_TIMING   RS Timing [b|a,]<TX_SPACE_US>,<RX_MSG_US>,<RX_BYTE_US>
    --rsx=dSZ,[HEX]      RS Xfer. Receive dSZ bytes, transmit [HEX]
    --fpwm=F_FREQ|N_SET  F<freq_hz|0> | <N>,<duty>
    --pwm=CONFIG|N_SET   C<res>,<limit> | <N>,<duty>
    --adc_cfg=ADC_CONFIG ADC Config e-enable|v-VCC|2-2.56V
    --adc=ADC_MUX        ADC Read
    --mdio=<R|W|a|w|r|p>,<PRT_PHY>,<DEV_REG>,[DATA] mdio xfer, R,W-Clause22
If you have questions about specific options let me know.

Heaton
Posts: 4
Joined: Mon Feb 01, 2010 9:30 pm

Re: Manual for sub_aap.exe

Post by Heaton »

I have the same issue.

--i2c=xSA,xMA_SZ,xMA,dSZ,[HEX] I2C Read/Write

Is ambiguous to me. So I messed with the command so there were no errors. However, in read or write mode it just returns with a blank line.

Can you give an example?

Heaton
Posts: 4
Joined: Mon Feb 01, 2010 9:30 pm

Re: Manual for sub_aap.exe

Post by Heaton »

Actually, looking at the code for sub_app.c it looks like the --i2c option does note write the read data back to the console.

Seems like a bug? ...


case 'R':
rc = sub_i2c_read( fd, config.sa, config.ma, config.ma_sz,
config.buf, config.sz );
break;

xol
Site Admin
Posts: 241
Joined: Sat Aug 29, 2009 8:04 am

Re: Manual for sub_aap.exe

Post by xol »

1. Regarding --i2c option
--i2c=xSA,xMA_SZ,xMA,dSZ,[HEX] I2C Read/Write

xSA - Slave Address in hexa ( like 51,2E,4D,... )
xMA_SZ - Memory/Register address size bytes in hexa
xMA - Memory/Register address inside slave device in hexa
dSZ - data size decimal
HEX - data to write in hexa like "55 44 3A 5B"

For example:
--i2c=50,2,200,4,"00 01 55 AA" will write 4 bytes to slave 0x50 at address 0x200, address size is 2 bytes.
Transaction corresponds to the following flow:
http://www.xdimax.com/sub20/doc/HTML/sub_i2c_write.htm

--i2c=50,2,200,4 will read 4 bytes from slave 0x50 at address 0x200, address size is 2 bytes.
http://www.xdimax.com/sub20/doc/HTML/sub_i2c_read.htm

Regarding dump of the I2C read buffer. It is definitely missing. You can add call to hex_ascii_dump to do it.
We will fix it in next version.
sub_app is mostly reference application to show C coding with SUB-20.

Post Reply