Hi Felipe,

I think these changes are fine to make the code more robust and to avoid
getting stuck in the while() loop.

You can use a timeout similar to used at lines 355 - 381.

BTW, if you are stuck at that while() chances are there are still some
issues on your SPI communication or board configuration.

Rodrigo tested the MFRC522 few days ago and everything worked as expected:

https://www.youtube.com/watch?v=a1MxyYRpmRI

BR,

Alan

On Wed, Aug 14, 2024 at 7:52 PM Felipe Moura Oliveira <moura....@gmail.com>
wrote:

> This kind of thing, can I change the code and request merge or do you
> prefer don’t touch in old code?
>
> *Felipe Moura de Oliveira*
> *Universidade Federal de Minas Gerais*
> Linkedin <https://www.linkedin.com/in/felipe-oliveira-75a651a0>
> <https://twitter.com/FelipeMOliveir?lang=pt-br>
>
>
> On Wed, 14 Aug 2024 at 19:42 Lwazi Dube <lwa...@gmail.com> wrote:
>
> > On Wed, 14 Aug 2024 at 18:07, Felipe Moura Oliveira <moura....@gmail.com
> >
> > wrote:
> >
> > > Hello all.
> > >
> > > I am porting MFRC_522 Driver to my esp32 board, during test process my
> > > firmware stuck in "while" and I am think about it (I was with hardware
> > > issue), look code below:
> > > When we use this driver, if we have any issue in the rfid IC our
> solution
> > > will be locked in the "while" at line 1103 and no report will be sent
> to
> > > us. This the right approach or do you think that it can be improved, at
> > > least with an error msg after timeout ?
> > >
> > >
> > I would timeout, return an error and check for it...
> >
> > here ...
> >           ret = mfrc522_init(dev);
> >           if (ret < 0)
> >             {
> >               return ret;
> >             }
> > and here ...
> >           ret = mfrc522_softreset(dev);
> >           if (ret < 0)
> >             {
> >               return ret;
> >             }
> >
> > Change the return types too please.
> >
> > int mfrc522_softreset(FAR struct mfrc522_dev_s *dev);
> > int mfrc522_init(FAR struct mfrc522_dev_s *dev);
> >
> > Return OK if there are no errors.
> >
>

Reply via email to