Page 1 of 1

Configuring GPIOB port on SUB-20-B

Posted: Wed Jan 12, 2011 5:08 pm
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 ?

Re: Configuring GPIOB port on SUB-20-B

Posted: Thu Jan 13, 2011 4:28 am
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

Re: Configuring GPIOB port on SUB-20-B

Posted: Thu Jan 13, 2011 3:14 pm
by rkuenzi
I have version 0.2.18 Were do I get version 0.3.0

Re: Configuring GPIOB port on SUB-20-B

Posted: Thu Jan 13, 2011 4:18 pm
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

Re: Configuring GPIOB port on SUB-20-B

Posted: Thu Jan 13, 2011 4:48 pm
by rkuenzi
I tried firmware version 0.2.9 and everything is now working correctly. Thanks :)

Re: Configuring GPIOB port on SUB-20-B

Posted: Thu Jan 13, 2011 5:02 pm
by serg
great