problem with UTP device when flashing custom i.MX6Q nand

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

problem with UTP device when flashing custom i.MX6Q nand

Jump to solution
1,618 Views
tgl
Contributor III

I am having an issue when trying to use mfgtool when trying to flash a custom board based on i.MX6Q that has the storage on a nand, the flashing stops at 'jumping into OS', trying to debug this with uuu on linux I see that the new device is created:

066f:37ff SigmaTel, Inc.

Nov 26 15:04:12 bigone kernel: [108686.008489] usb 3-5: new high-speed USB device number 15 using xhci_hcd
Nov 26 15:04:12 bigone kernel: [108686.169716] usb 3-5: New USB device found, idVendor=066f, idProduct=37ff, bcdDevice= 3.99
Nov 26 15:04:12 bigone kernel: [108686.169721] usb 3-5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Nov 26 15:04:12 bigone kernel: [108686.169724] usb 3-5: Product: File-backed Storage Gadget
Nov 26 15:04:12 bigone kernel: [108686.169726] usb 3-5: Manufacturer: Linux 3.0.35+ with fsl-usb2-udc
Nov 26 15:04:12 bigone kernel: [108686.179220] usb-storage 3-5:1.0: USB Mass Storage device detected

but then:

Nov 26 15:04:13 bigone kernel: [108687.181735] scsi 6:0:0:0: Direct-Access Linux File-Stor Gadget 0399 PQ: 0 ANSI: 2
Nov 26 15:04:13 bigone kernel: [108687.182473] sd 6:0:0:0: Attached scsi generic sg4 type 0
Nov 26 15:04:13 bigone kernel: [108687.184606] sd 6:0:0:0: [sde] Sector size 0 reported, assuming 512.
Nov 26 15:04:13 bigone kernel: [108687.184620] sd 6:0:0:0: [sde] 1 512-byte logical blocks: (512 B/512 B)
Nov 26 15:04:13 bigone kernel: [108687.184625] sd 6:0:0:0: [sde] 0-byte physical blocks
Nov 26 15:04:13 bigone kernel: [108687.186576] sd 6:0:0:0: [sde] Write Protect is off
Nov 26 15:04:13 bigone kernel: [108687.186580] sd 6:0:0:0: [sde] Mode Sense: 0f 00 00 00
Nov 26 15:04:13 bigone kernel: [108687.188600] sd 6:0:0:0: [sde] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Nov 26 15:04:13 bigone kernel: [108687.215556] sd 6:0:0:0: [sde] Sector size 0 reported, assuming 512.
Nov 26 15:04:13 bigone kernel: [108687.252498] scsi_io_completion_action: 4 callbacks suppressed
Nov 26 15:04:13 bigone kernel: [108687.252501] sd 6:0:0:0: [sde] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
Nov 26 15:04:13 bigone kernel: [108687.252504] sd 6:0:0:0: [sde] tag#0 Sense Key : Medium Error [current]
Nov 26 15:04:13 bigone kernel: [108687.252506] sd 6:0:0:0: [sde] tag#0 Add. Sense: Recorded entity not found

etc, its not recognized most likely in virtualbox because of the same problem

in the serial console I see this:

 

Starting UTP
ln: /etc/mtab: File exists
disable turn off display
/linuxrc: line 13: can't create /dev/tty0: No such device or address
Starting the hotplug events dispatcher udevd
[ 2.246635] udevd (742): /proc/742/oom_adj is deprecated, please use /proc/742/oom_score_adj instead.
Synthesizing initial hotplug events
[ 2.358314] g_file_storage gadget: high speed config #1
uuc 0.4 [built Aug 16 2013 01:24:08]
UTP: Waiting for device to appear
UTP: file/device node /dev/utp already exists
cpu_id is 0

the card works fine with its current OS that is flashed on it, i want to flash a new u-boot and a new rootfs

 

0 Kudos
Reply
1 Solution
1,559 Views
tgl
Contributor III

In the end I was able to solve the problem myself.

By default VirtualBox has USB 1.1 (OHCI) controller, I switched that to USB 2.0 (OHCI + EHCI) and now it works as expected.

View solution in original post

0 Kudos
Reply
3 Replies
1,560 Views
tgl
Contributor III

In the end I was able to solve the problem myself.

By default VirtualBox has USB 1.1 (OHCI) controller, I switched that to USB 2.0 (OHCI + EHCI) and now it works as expected.

0 Kudos
Reply
1,585 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

I would like to know how are you running the tool?
Are you using a virtual machine to run the tool in Linux?

Does the tool hang there or outputs some error?
Please run the tool in verbose mode and share the tool output

Best regards,
Aldo.

0 Kudos
Reply
1,579 Views
tgl
Contributor III

Hello,

Mainly I am trying the mfgtool (not uuu) under Windows in a VirtualBox, that one hangs because the device that is created under Windows is malfunctioning, practically its creating the storage device (Linux 3.0.35+ with fsl-usb2-udc) when I attach the USB device, but nothing is mounted and the device is marked as invalid, therefore the mfgtool can't see it.

Config of mfg tool on Windows:

 

<UCL>
<CFG>
<STATE name="BootStrap" dev="MX6Q" vid="15A2" pid="0054"/>
<STATE name="Updater" dev="MSC" vid="066F" pid="37FF"/>
</CFG>

<!-- GHAC -->

<LIST name="GHAC-NAND" desc="Choose NAND as media">

<CMD state="BootStrap" type="find" body="Recovery" timeout="180"/>
<CMD state="BootStrap" type="boot" body="Recovery" file ="u-boot-ghac-mfg.bin" >Loading uboot.</CMD>
<CMD state="BootStrap" type="load" file="uImage-mfg" address="0x10800000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Doing Kernel.</CMD>
<CMD state="BootStrap" type="load" file="initramfs.cpio.gz.uboot" address="0x10C00000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Doing Initramfs.</CMD>
<CMD state="BootStrap" type="jump" > Jumping to OS image. </CMD>
<CMD state="BootStrap" type="find" body="Updater" timeout="180"/>

<CMD state="Updater" type="push" body="$ flash_erase /dev/mtd0 0 0">Erasing U-boot partition</CMD>
...

 

Log of mfgtool on Windows:

 

Wednesday, December 01, 2021 23:18:07 Start new logging
ModuleID[2] LevelID[10]: CMyExceptionHandler thread is running
ModuleID[2] LevelID[1]: new MxHidDeviceClass
ModuleID[2] LevelID[10]: new MxHidDevice[02DB2918]
ModuleID[2] LevelID[10]: Device Manager thread is running
ModuleID[2] LevelID[10]: CmdOperation[0] device chagned and reset to state 0
ModuleID[2] LevelID[10]: ExecuteCommand--Boot[WndIndex:0], File is Z:\mfgtool_4_1_0-ghac-20141113\Profiles\MX6Q Linux Update\OS Firmware\u-boot-mfg-good.bin
ModuleID[2] LevelID[10]: ExecuteCommand--Load[WndIndex:0], File is Z:\mfgtool_4_1_0-ghac-20141113\Profiles\MX6Q Linux Update\OS Firmware\uImage-mfg, address is 0x10800000
ModuleID[2] LevelID[10]: PortMgrDlg(0)--Command Load excute successfully, retry count: 0
ModuleID[2] LevelID[10]: ExecuteCommand--Load[WndIndex:0], File is Z:\mfgtool_4_1_0-ghac-20141113\Profiles\MX6Q Linux Update\OS Firmware\initramfs.cpio.gz.uboot, address is 0x10C00000
ModuleID[2] LevelID[10]: PortMgrDlg(0)--Command Load excute successfully, retry count: 0
ModuleID[2] LevelID[10]: ExecuteCommand--Jump[WndIndex:0]
ModuleID[2] LevelID[10]: *********MxHidDevice[02DB2918] Jump to Ramkernel successfully!**********
ModuleID[2] LevelID[10]: CmdOperation[0], current state command has been finished and the last command is successful, so SetEvent(hDevCanDeleteEvent)
ModuleID[2] LevelID[10]: DeviceManager::DevChangeWnd::OnDeviceChange() - DEVICE_REMOVAL_EVT(\\?\USB#VID_15A2&PID_0054#5&18f54cb7&0&2#{a5dcbf10-6530-11d2-901f-00c04fb951ed})
ModuleID[2] LevelID[10]: DeviceManager::DevChangeWnd::OnDeviceChange() - end
ModuleID[2] LevelID[10]: DeviceManager::OnMsgDeviceEvent() - DEVICE_REMOVAL_EVT(\\?\USB#VID_15A2&PID_0054#5&18f54cb7&0&2#{a5dcbf10-6530-11d2-901f-00c04fb951ed})
ModuleID[2] LevelID[10]: DeviceClass::FindDeviceByUsbPath--DeviceListType_Current, _devices.size: 1
ModuleID[2] LevelID[10]: DeviceClass::FindDeviceByUsbPath--DeviceListType_Current, devInstPathToFind: USB\VID_15A2&PID_0054\5&18F54CB7&0&2, _deviceInstanceID: USB\VID_15A2&PID_0054\5&18F54CB7&0&2
ModuleID[2] LevelID[10]: DeviceClass::FindDeviceByUsbPath--DeviceListType_Current, Find the device
ModuleID[2] LevelID[10]: DeviceManager::OnMsgDeviceEvent() - DEVICE_REMOVAL_EVT,[MxHidDeviceClass] vid_15a2&pid_0054, Hub:1-Port:2
ModuleID[2] LevelID[10]: DeviceManager::OnMsgDeviceEvent() - DEVICE_REMOVAL_EVT, Notify
ModuleID[2] LevelID[10]: CmdOpreation[0]--OnDeviceChangeNotify, Volume Arrive/Remove or Device Arrive/Remove
ModuleID[2] LevelID[10]: CmdOpreation[0]--OnDeviceChangeNotify, m_p_usb_port is not NULL, so only refresh
ModuleID[2] LevelID[10]: CmdOpreation[0]--OnDeviceChangeNotify, Volume/Device Remove
ModuleID[2] LevelID[1]: CmdOpreation[0]--set m_hDeviceRemoveEvent.
ModuleID[2] LevelID[10]: CmdOpreation[0]--WaitforEvents device remove1
ModuleID[2] LevelID[10]: DeviceManager::OnMsgDeviceEvent()-DEVICE_REMOVAL_EVT, hDevCanDeleteEvent has been set
ModuleID[2] LevelID[10]: delete MxHidDevice[02DB2918]
ModuleID[2] LevelID[10]: CCmdOpreation[0] thread is Closed
ModuleID[2] LevelID[10]: CCmdOpreation[0] thread is Closed
ModuleID[2] LevelID[10]: DeviceManager::OnMsgDeviceEvent() - EVENT_KILL
ModuleID[2] LevelID[10]: CMyExceptionHandler::OnMsgExceptionEvent() - KillExceptionHandlerThread
ModuleID[2] LevelID[10]: Exception Handler thread is closed
ModuleID[2] LevelID[1]: delete MxHidDeviceClass
ModuleID[2] LevelID[10]: Device Manager thread is closed

 

Windows error:

Device USB\VID_066F&PID_37FF\5&18f54cb7&0&2 had a problem starting.

Driver Name: usbstor.inf
Class Guid: {36fc9e60-c465-11cf-8056-444553540000}
Service: USBSTOR
Lower Filters:
Upper Filters:
Problem: 0xA
Problem Status: 0xC000000D

Then I did also further debugging directly on Linux with uuu and I saw the errors posted in the previous post. I did this on two boards and I get the same issue, so its most likely unrelated to the hardware, what happens is:

1. u-boot, uImage and initramfs are written into memory, it jumps into the u-boot and loads the initramfs (works fine on Linux and Windows VirtualBox)

 

Wait for Known USB Device Appear...
New USB Device Attached at 3:5
3:5>Start Cmd:SDP: boot -f u-boot-ghac-mfg.bin -nojump
100%3:5>Okay (2.132s)
3:5>Start Cmd:SDP: write -f uImage-mfg -addr 0x10800000
99%3:5>Okay (1.012s)
3:5>Start Cmd:SDP: write -f initramfs.cpio.gz.uboot -addr 0x10C00000
99%3:5>Okay (1.821s)
3:5>Start Cmd:SDP: jump -f u-boot-ghac-mfg.bin -ivt
6400%3:5>Okay (1.001s)

 


2. after the uImage boots and loads the initramfs, an USB device (g_file_storage, idVendor=066f, idProduct=37ff) is created but it can't mount anything from the NAND as it most likely can't find the partitions;
note that the NAND is fine as the boards are booting normally with the old images written on them, I just can't flash anything new on /dev/mtd0 /dev/mtd1 etc

In theory this SHOULD happen:

 

... usb 1-1.4: configuration #1 chosen from 1 choice
... scsi1 : SCSI emulation for USB Mass Storage devices
... Vendor: Linux Model: File-Stor Gadget Rev: 0314
... Type: Direct-Access ANSI SCSI revision: 02
... SCSI device sde: 8192 512-byte hdwr sectors (4 MB)

 

In practice this happens:

 

Nov 26 15:04:13 bigone kernel: [108687.181735] scsi 6:0:0:0: Direct-Access Linux File-Stor Gadget 0399 PQ: 0 ANSI: 2
Nov 26 15:04:13 bigone kernel: [108687.182473] sd 6:0:0:0: Attached scsi generic sg4 type 0
Nov 26 15:04:13 bigone kernel: [108687.184606] sd 6:0:0:0: [sde] Sector size 0 reported, assuming 512.
Nov 26 15:04:13 bigone kernel: [108687.184620] sd 6:0:0:0: [sde] 1 512-byte logical blocks: (512 B/512 B)
Nov 26 15:04:13 bigone kernel: [108687.184625] sd 6:0:0:0: [sde] 0-byte physical blocks
Nov 26 15:04:13 bigone kernel: [108687.186576] sd 6:0:0:0: [sde] Write Protect is off
Nov 26 15:04:13 bigone kernel: [108687.186580] sd 6:0:0:0: [sde] Mode Sense: 0f 00 00 00
Nov 26 15:04:13 bigone kernel: [108687.188600] sd 6:0:0:0: [sde] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Nov 26 15:04:13 bigone kernel: [108687.215556] sd 6:0:0:0: [sde] Sector size 0 reported, assuming 512.
Nov 26 15:04:13 bigone kernel: [108687.252498] scsi_io_completion_action: 4 callbacks suppressed
Nov 26 15:04:13 bigone kernel: [108687.252501] sd 6:0:0:0: [sde] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
Nov 26 15:04:13 bigone kernel: [108687.252504] sd 6:0:0:0: [sde] tag#0 Sense Key : Medium Error [current]
Nov 26 15:04:13 bigone kernel: [108687.252506] sd 6:0:0:0: [sde] tag#0 Add. Sense: Recorded entity not found

 

0 Kudos
Reply