Configuring GPIOB port on SUB-20-B

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

Moderator: serg

Post Reply
rkuenzi
Posts: 3
Joined: Wed Jan 12, 2011 4:54 pm

Configuring GPIOB port on SUB-20-B

Post by rkuenzi »

I am having trouble configuring the GPIOB port on the SUB-20-B.
Here is my code:
// --- Set GPIOB port Configuration
// Since the SPI port is shared with GPIOB, need to disable SPI functionality (see below)
retval = sub_spi_config(handle, 0, 0);
// 7654 3210
// GPIOB set 0000 0000; 0-Input, 1-Output
// GPIOB mask 1111 1111; 1-Bit Enabled

retval = sub_gpiob_config(handle, 0x00, &pin_config, 0xFF);
if (retval != 0)
{
printf("\nsub_gpiob_config(): %s\n", sub_strerror(retval));
Sleep(5000);
return 0;
}

retval = sub_gpiob_config(handle, 0, &pin_config, 0);
printf("\nGPIOB Config: %d", pin_config);

If sub_spi_config(handle, 0, 0) isn't used before sub_gpiob_config(handle, 0x00, &pin_config, 0xFF), I get the 13 error - Wrong tag size in response

If I include sub_spi_config(handle, 0, 0) the 13 error goes away, but the GPIOB Config always stays at 16 (0x10).

Any ideas ?

serg
Posts: 143
Joined: Mon Aug 31, 2009 9:17 pm

Re: Configuring GPIOB port on SUB-20-B

Post by serg »

hi rkuenzi,
I cannot reproduce the problem on a board with firmware version 0.3.0.
I get retval == 0 and pin_config == 0 ( no sub_spi_config call). What firmware version do you use? If its older than 0.3.0 could you please update it and try again?
thanks

rkuenzi
Posts: 3
Joined: Wed Jan 12, 2011 4:54 pm

Re: Configuring GPIOB port on SUB-20-B

Post by rkuenzi »

I have version 0.2.18 Were do I get version 0.3.0

serg
Posts: 143
Joined: Mon Aug 31, 2009 9:17 pm

Re: Configuring GPIOB port on SUB-20-B

Post by serg »

The latest release includes the v0.2.9 firmware. Try this one first. Just download and install the latest build from the release section of this forum. The firmware is located under \program files\sub-20\firmware

rkuenzi
Posts: 3
Joined: Wed Jan 12, 2011 4:54 pm

Re: Configuring GPIOB port on SUB-20-B

Post by rkuenzi »

I tried firmware version 0.2.9 and everything is now working correctly. Thanks :)

serg
Posts: 143
Joined: Mon Aug 31, 2009 9:17 pm

Re: Configuring GPIOB port on SUB-20-B

Post by serg »

great

Post Reply