Bug in avr_tpi_poll_nvmbsy()?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug in avr_tpi_poll_nvmbsy()?

Hannes Weisbach-2
Hello,

I am currently implementing TPI for avrftdi and I stumbled across a possible bug in avr_tpi_poll_nvmbsy(). Since I am not that familiar with the TPI-code in avr.c I though I'd better ask. avr_tpi_poll_nvmbsy() reads out the NVMCSR register like so:

cmd = TPI_CMD_SIN | TPI_SIO_ADDR(TPI_IOREG_NVMCSR);
rc = pgm->cmd_tpi(pgm, &cmd, 1, &res, 1);

But instead of reading the response the return code is checked for the busy flag:
return (rc & TPI_IOREG_NVMCSR_NVMBSY);

Shouldn't it rather be:
return (res & TPI_IOREG_NVMCSR_NVMBSY);?

(With that change avrftdi programs flash over TPI, so please say 'yes' ;))

Best regards,
Hannes
_______________________________________________
avrdude-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev
Reply | Threaded
Open this post in threaded view
|

Re: Bug in avr_tpi_poll_nvmbsy()?

Darell Tan
Hi Hannes,

Oh yes that's definitely a bug, since cmd_tpi just does dumb RX and TX. In
my testing, serial bitbanging was probably slow enough that it didn't
matter. Please fix it to make avrftdi work!

Thanks.

--
Regards,
Darell Tan


On Tue, Apr 30, 2013 at 10:54 PM, Hannes Weisbach
<[hidden email]>wrote:

> Hello,
>
> I am currently implementing TPI for avrftdi and I stumbled across a
> possible bug in avr_tpi_poll_nvmbsy(). Since I am not that familiar with
> the TPI-code in avr.c I though I'd better ask. avr_tpi_poll_nvmbsy() reads
> out the NVMCSR register like so:
>
> cmd = TPI_CMD_SIN | TPI_SIO_ADDR(TPI_IOREG_NVMCSR);
> rc = pgm->cmd_tpi(pgm, &cmd, 1, &res, 1);
>
> But instead of reading the response the return code is checked for the
> busy flag:
> return (rc & TPI_IOREG_NVMCSR_NVMBSY);
>
> Shouldn't it rather be:
> return (res & TPI_IOREG_NVMCSR_NVMBSY);?
>
> (With that change avrftdi programs flash over TPI, so please say 'yes' ;))
>
> Best regards,
> Hannes
> _______________________________________________
> avrdude-dev mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/avrdude-dev
>
_______________________________________________
avrdude-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev