Reply To: Hobby Components Altera USB Blaster frequently causing bsod during flashing

NewHome Forums OSSC & OSSC Pro OSSC – DIY Support Hobby Components Altera USB Blaster frequently causing bsod during flashing Reply To: Hobby Components Altera USB Blaster frequently causing bsod during flashing

#24590
DevLatron
Participant

Thanks, @marqs.

I’ve done a bit of research. I can get a connection to the JTAG chain occasionally, with both of these devices:

USB Blaster with STMF103C8T6
Terasic USB Blaster with Altera 5M160ZE64C5N

Starting jtagd as root with an strace -f allowed me to trace through the behavior:

Often, the jtagd gets stuck in a loop which eventually segfaults. This happens with the quartus software or when using jtagconfig:

ioctl(6, USBDEVFS_REAPURBNDELAY, 0x7fff1cc3cad8) = -1 EAGAIN (Resource temporarily unavailable)
select(7, NULL, [6], NULL, {tv_sec=5, tv_usec=0}) = 1 (out [6], left {tv_sec=4, tv_usec=999874})
ioctl(6, USBDEVFS_REAPURBNDELAY, 0x7fff1cc3cad8) = 0
ioctl(6, USBDEVFS_REAPURBNDELAY, 0x7fff1cc3cad8) = 0
ioctl(6, USBDEVFS_SUBMITURB, 0x125ed40) = 0
ioctl(6, USBDEVFS_SUBMITURB, 0x125ef50) = 0
ioctl(6, USBDEVFS_REAPURBNDELAY, 0x7fff1cc3cad8) = -1 EAGAIN (Resource temporarily unavailable)
select(7, NULL, [6], NULL, {tv_sec=5, tv_usec=0}) = 1 (out [6], left {tv_sec=4, tv_usec=999869})
ioctl(6, USBDEVFS_REAPURBNDELAY, 0x7fff1cc3cad8) = 0
ioctl(6, USBDEVFS_REAPURBNDELAY, 0x7fff1cc3cad8) = 0
ioctl(6, USBDEVFS_SUBMITURB, 0x125ef98) = 0
ioctl(6, USBDEVFS_REAPURBNDELAY, 0x7fff1cc3cad8) = -1 EAGAIN (Resource temporarily unavailable)
select(7, NULL, [6], NULL, {tv_sec=5, tv_usec=0}) = 1 (out [6], left {tv_sec=4, tv_usec=999856})
ioctl(6, USBDEVFS_REAPURBNDELAY, 0x7fff1cc3cad8) = 0

The eventual segfault:

ioctl(6, USBDEVFS_REAPURBNDELAY, 0x7fff1cc3dab8) = -1 EAGAIN (Resource temporarily unavailable)
select(7, NULL, [6], NULL, {tv_sec=5, tv_usec=0}) = 1 (out [6], left {tv_sec=4, tv_usec=999873})
ioctl(6, USBDEVFS_REAPURBNDELAY, 0x7fff1cc3dab8) = 0
ioctl(6, USBDEVFS_REAPURBNDELAY, 0x7fff1cc3dab8) = -1 EAGAIN (Resource temporarily unavailable)
select(7, NULL, [6], NULL, {tv_sec=5, tv_usec=0}) = 1 (out [6], left {tv_sec=4, tv_usec=999318})
ioctl(6, USBDEVFS_REAPURBNDELAY, 0x7fff1cc3dab8) = 0
writev(5, [{iov_base="\0\3", iov_len=2}, {iov_base="\0\0\0\4", iov_len=4}], 2) = 6
select(6, [3 5], NULL, NULL, {tv_sec=1073, tv_usec=741823}) = 1 (in [5], left {tv_sec=1073, tv_usec=741756})
recvfrom(5, "\0\37", 2, 0, NULL, NULL)  = 2
recvfrom(5, "\251\0\0 \0\22\0\1\0\0\0\0\23JTAG Chain Debugger", 32, 0, NULL, NULL) = 32
writev(5, [{iov_base="\0\7", iov_len=2}, {iov_base="\0\0\0\10\1\0\0\0", iov_len=8}], 2) = 10
select(6, [3 5], NULL, NULL, {tv_sec=1073, tv_usec=741823}) = 1 (in [5], left {tv_sec=1073, tv_usec=741821})
recvfrom(5, "\0\7", 2, 0, NULL, NULL)   = 2
recvfrom(5, "\243\0\0\10\0\22\0\1", 8, 0, NULL, NULL) = 8
writev(5, [{iov_base="\0\3", iov_len=2}, {iov_base="\0\0\0\4", iov_len=4}], 2) = 6
select(6, [3 5], NULL, NULL, {tv_sec=1073, tv_usec=741823}) = 1 (in [5], left {tv_sec=1073, tv_usec=741821})
recvfrom(5, "\0\33", 2, 0, NULL, NULL)  = 2
recvfrom(5, "\301\0\0\f\1\0\0\0\0\0\3\350\311\0\0\20\1\0\0\0\0\0\0\5\0\0\0\1", 28, 0, NULL, NULL) = 28
recvfrom(5, "@\0", 2, 0, NULL, NULL)    = 2
recvfrom(5, "\0", 1, 0, NULL, NULL)     = 1
recvfrom(5, "P\0", 2, 0, NULL, NULL)    = 2
recvfrom(5, "\377", 1, 0, NULL, NULL)   = 1
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x40127a014} ---
+++ killed by SIGSEGV (core dumped) +++

Steadily plugging the device in and back out will eventually get a recognition off of the device:


geiger@loki:~$ jtagconfig
1) USB-Blaster [1-1.2]
  Unable to read device chain - JTAG chain broken

geiger@loki:~$ jtagconfig 
1) USB-Blaster [1-1.2]
  Unable to read device chain - JTAG chain broken

geiger@loki:~$ jtagconfig 
1) USB-Blaster [1-1.2]
  Unable to read device chain - JTAG chain broken

geiger@loki:~$ jtagconfig 
1) USB-Blaster [1-1.2]
  020F20DD   10CL016(Y|Z)/EP3C16/EP4CE15

Once this occurs, one can actually attach different JTAG chains to it. As long as the device stays initialized, it can be used to push the bitstream.

Important here: The OSSCs in questions don’t play a role in this situation. The devices seem to hang on initialization with the JTAG daemon. One can cause them to hang or work without having the OSSC connected, and then reattach different OSSCs after the initialization works.

I’ve gathered quite a lot of different straces for this from jtagd and will gladly open up a bug/issue with the Quartus team if someone might point me to the right direction. 😉

also @marqs: Did you see my Pull Request on GITHUB? Having that merged would make assembly tutorials a bit easier. 😉