Configuring GPIOB port on SUB-20-B
Posted: Wed Jan 12, 2011 5:08 pm
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 ?
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 ?