Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI_CMD_GET_BAUD not working #9

Open
mcsmark opened this issue Oct 29, 2024 · 4 comments
Open

SPI_CMD_GET_BAUD not working #9

mcsmark opened this issue Oct 29, 2024 · 4 comments

Comments

@mcsmark
Copy link

mcsmark commented Oct 29, 2024

I use the AVRISP protocol. But for some reason the SPI_CMD_GET_BAUD does not work.
I do not get a valid response. I tried with SNAP and a curiosity 168 board.
this is the test code
command = bytearray([AvrIspProtocol.SPI_CMD_GET_BAUD])
self._spi_cmd_resp(command)

in the docs there is link to AVR069. but that use a different way of setting the clock.

this is the webpage ; https://onlinedocs.microchip.com/oxy/GUID-33422CDF-8B41-417C-9C31-E4521ADAE9B4-en-US-2/GUID-1FCCECA1-F85C-4179-BFEC-15CB8F6388AE.html

i did see in the code that spi clock is todo. maybe it was not done because it does not work?
a tool like studio does not offer a way to set the clock either. it is kind of odd.

@xedbg
Copy link

xedbg commented Nov 5, 2024

BAUD set/get is implemented on Snap.
I think the issue here is probably that _spi_cmd_resp() does not expect anything but "OK" or "Clock error" back from the tool.
(https://github.com/microchip-pic-avr-tools/pyedbglib/blob/main/pyedbglib/protocols/avrispprotocol.py#L103)
GET_BAUD returns the little-endian baud followed by OK (this could probably be confirmed by enabling debug logging)

@mcsmark
Copy link
Author

mcsmark commented Nov 5, 2024

thanks for your reply. i tried various programmers that support ISP protocol : SNAP, jtagice3, 168PB Xplained.
i always get a protocol error. Setting the baud works but has no effect on some of the programmers. When i look in AVR Studio 7 only JTAGICE3 offers a way to set the clock. so i think the other devices have a fixed clock. i guess i need to contact microchip.
and lastly, the microchip docs differ from the one from pyedbglib. using the source code works. when you just look at the documents (pdf and web) there are some small differences for some functions. it is great to have the working python source.
i will ask microchip about these issues,

@xedbg
Copy link

xedbg commented Nov 5, 2024

I have worked with many of these tools over the years, so here is a quick summary:

  • JTAGICE3 + Atmel-ICE + PowerDebugger offer a wide range of SPI clock
  • mEDBG (Xplained Mini) kits are simplified/stripped down and (maybe?) have a fixed clock
  • Snap and PICkit4 via pyedbglib are in "AVR mode" interim solutions with much lower clock granularity, if any - the newer versions of these tools use an entirely different system, incompatible with pyedbglib

So "newer" tools are technically less capable when using SPI - newer AVR devices use UPDI, so that's where the emphasis is.

@mcsmark
Copy link
Author

mcsmark commented Nov 5, 2024

thanks. yes that is understandable. I also endorse UPDI chips. But some customers need older ISP. Since ISP is built into SNAP i added it. And then i found mEDBG which also works well. except for the clock. a pity no source of the protocol is available otherwise i could have changed it. it is hard to get a good programmer that is affordable and easy to setup. the EDBG is simple to setup. I could do usbasp or some variant but the downside is the driver/libusb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants