mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
drivers/ioexpander/iso1i813t.c: fix error startup condition
The reference manual (section 3.2.1) states the user has to read GLERR and INTERR registers to clear their bits and release ERR pin after the startup sequence. Error bits are set to 1 after the startup if external power supply is used. Not clearing the bits leads to subsequent read call errors if VBB errors are checked. Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
parent
aeaa13227e
commit
69249fc9e6
1 changed files with 16 additions and 0 deletions
|
|
@ -511,6 +511,7 @@ FAR struct ioexpander_dev_s *iso1i813t_initialize(FAR struct spi_dev_s *spi,
|
|||
FAR struct iso1i813t_config_s *config)
|
||||
{
|
||||
FAR struct iso1i813t_dev_s *priv;
|
||||
uint8_t txdata;
|
||||
|
||||
#ifdef CONFIG_ISO1I813T_MULTIPLE
|
||||
/* Allocate the device state structure */
|
||||
|
|
@ -535,6 +536,21 @@ FAR struct ioexpander_dev_s *iso1i813t_initialize(FAR struct spi_dev_s *spi,
|
|||
|
||||
nxmutex_init(&priv->lock);
|
||||
|
||||
/* Read GLERR and INTERR registers to clear their status bits
|
||||
* and release ERR pin after the startup sequence. This is a required
|
||||
* step if external power supply is used.
|
||||
*/
|
||||
|
||||
txdata = ISO1I813T_GLERR;
|
||||
iso1i813t_select(priv->spi, priv->config, 8);
|
||||
SPI_EXCHANGE(priv->spi, &txdata, NULL, 1);
|
||||
iso1i813t_deselect(priv->spi, priv->config);
|
||||
|
||||
txdata = ISO1I813T_INTERR;
|
||||
iso1i813t_select(priv->spi, priv->config, 8);
|
||||
SPI_EXCHANGE(priv->spi, &txdata, NULL, 1);
|
||||
iso1i813t_deselect(priv->spi, priv->config);
|
||||
|
||||
return &priv->dev;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue