UART question: Rescue Loader / UART loopback switch - page 4 - General Discussion and Assistance - CHDK Forum

UART question: Rescue Loader / UART loopback switch

  • 51 Replies
  • 14556 Views
*

Offline reyalp

  • ******
  • 13387
Re: UART question: Rescue Loader / UART loopback switch
« Reply #30 on: 26 / October / 2017, 23:58:09 »
Advertisements
I do agree, booloader should have some simplifications. There is a lot of questions.
does it support Fat16 only? Partitions? Fragmented file? 2gb max SD cards?
Those are good questions, and I don't know the answer. A freshly formatted FAT16 would seem like a fair bet.
Quote
I can't be sure that i made a correct unencoded diskboot.bin because how do i test one? Using additionAgent("a/unencoded.bin")?
Assuming your build process is based on CHDK, just skipping the 'dancingbits' step should be sufficient. You can do this by undefining NEED_ENCODED_DISKBOOT (see the top level Makefile.

However, looking at the romstarter code, it does appear to reference the dancingbits key.

A few other notes:

It seems like loopback need to be on at boot and then go off. (Loop around fc0004d8 on g7x)

The loader (function called just before "DISKBOOT.BIN is started.", fc003134 on g7x) appears to check for 0 in the first byte and "gaonisoy" starting at offset 16. This is *before* the stuff that references the dancingbits key (referenced in a function pointer from the function called at the end of the one that checks "gaonisoy", fc0035d4).

I may well have misinterpreted some of this stuff...

edit:
Regarding format, I see the following in ROMSTARTER
ERROR: bsFATsec is over 4MB Limit
FORMAT ERROR (NOT FAT12/16/32)

Random idea: It may be possible to test details of encoding etc on a working camera by calling into the ROMSTARTER code somewhere after the UART check.
« Last Edit: 27 / October / 2017, 00:10:07 by reyalp »
Don't forget what the H stands for.

*

Offline Ant

  • ****
  • 491
Re: UART question: Rescue Loader / UART loopback switch
« Reply #31 on: 27 / October / 2017, 00:32:43 »
IIRC rescue loader contains dancing bits too. So it uses the encoded diskboot.bin.
You can check it using QEMU.

Re: UART question: Rescue Loader / UART loopback switch
« Reply #32 on: 27 / October / 2017, 03:11:21 »
i am making a pause on this research because of a business trip for two weeks.  Meanwhile I have ordered a bus pirate tool.  it will be fun.

Thank you all for your suggestions! i really appreciate it.

*

Offline Ant

  • ****
  • 491
Re: UART question: Rescue Loader / UART loopback switch
« Reply #33 on: 27 / October / 2017, 05:34:07 »
Meanwhile I have ordered a bus pirate tool.
Make sure it's compatible with 1.8v levels
And check voltage on TX pad of your camera.


Re: UART question: Rescue Loader / UART loopback switch
« Reply #34 on: 27 / October / 2017, 09:17:26 »
Meanwhile I have ordered a bus pirate tool.
Make sure it's compatible with 1.8v levels
And check voltage on TX pad of your camera.

i have already ordered. it was advertised as 0-5.5volts, we will see. 

Re: UART question: Rescue Loader / UART loopback switch
« Reply #35 on: 15 / November / 2017, 14:48:45 »
Status report:
i have received a bus pirate, and measured level on camera TX (it is 0V initially and it switches to 1.84V on ON/OFF button press)
I have connected RX of bus pirate to TX of camera  (and GND too) and I see that camera sends 0x00 0x23  bytes  (00 and '#') on a button press.
the camera reacts to button, and it  is somehow alive and it is a good sign.

i have tried the hardware loopback and sending 0x00 and # in many combination to the camera i never  saw any answer.

example log:

=
UART>#
RE
Bus Pirate v3.b clone w/different PIC
Firmware v6.1 r1676  Bootloader v4.4
DEVID:0x044F REVID:0x3043 (24FJ64GA004 B5)
http://dangerousprototypes.com
HiZ>m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)

(1)>3
Set serial port speed: (bps)
 1. 300
 2. 1200
 3. 2400
 4. 4800
 5. 9600
 6. 19200
 7. 38400
 8. 57600
 9. 115200
10. BRG raw value

(1)>9
Data bits and parity:
 1. 8, NONE *default
 2. 8, EVEN
 3. 8, ODD
 4. 9, NONE
(1)>
Stop bits:
 1. 1 *default
 2. 2
(1)>
Receive polarity:
 1. Idle 1 *default
 2. Idle 0
(1)>
Select output type:
 1. Open drain (H=Hi-Z, L=GND)
 2. Normal (H=3.3V, L=GND)

(1)>2
Ready
UART>[
UART LIVE DISPLAY, } TO STOP
UART>
READ: -f 0x00
UART>
READ: -f 0x00
UART>
READ: -f 0x00
UART>
READ: -f 0x00
UART>
READ: 0x00

READ: 0x23
UART>"#"
WRITE: "#"
UART>0x0A
WRITE: 0x0A
UART>"#"
WRITE: "#"
UART>"######"
WRITE: "######"
UART>
=
I think i need to examine the bootloader to undertand what does it expect.

« Last Edit: 15 / November / 2017, 15:45:50 by hardlock »

Re: UART question: Rescue Loader / UART loopback switch
« Reply #36 on: 16 / November / 2017, 14:59:57 »
i have checked the code, there is a  pause of  (10000*5*nop) after displaying first character of  "#RomStarter Ver2.01 for EC382\n\r" and the same character is expected to be entered from the UART console. I dont know the CPU freq, but for 1 GHz CPU the pause will be just 0.5 millisecond. I see no reason for hardware loop back  (RX-TX) to not work.




*

Offline Ant

  • ****
  • 491
Re: UART question: Rescue Loader / UART loopback switch
« Reply #37 on: 17 / November / 2017, 03:01:50 »
I see no reason for hardware loop back  (RX-TX) to not work.


Keep trying to send "#" characters from your terminal or create a script for it.
Try to do it after closing battery cover or after pressing power button.
Somehow I've managed to enter rescue loader one or two times. I believe you will able too...
Unfortunately now my camera is assembled  for normal use  and I can't check this again.
Code: [Select]
<0>##RomStarter Ver1.06 for EC374

UUART loopback switch OFF...

Rescue Loader



---------------------------

BootSector ReadError

--- DISKBOOT.BIN start ABORT!!! ---


>> debug shell startted <<
>> ###
« Last Edit: 17 / November / 2017, 12:07:18 by Ant »


Re: UART question: Rescue Loader / UART loopback switch
« Reply #38 on: 19 / November / 2017, 05:26:09 »
thank you very much, i found a procedure to enter to thedebug shell

I use  R1=1K, R2=1.22K voltage divider to convert 3.3V levels  to 1.8V

============== remove battery, and SD card ==========
====================== Set uart to 115200, 8N1 =========
HiZ>m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)

(1)>3
Set serial port speed: (bps)
 1. 300
 2. 1200
 3. 2400
 4. 4800
 5. 9600
 6. 19200
 7. 38400
 8. 57600
 9. 115200
10. BRG raw value

(1)>9
Data bits and parity:
 1. 8, NONE *default
 2. 8, EVEN
 3. 8, ODD
 4. 9, NONE
(1)>1
Stop bits:
 1. 1 *default
 2. 2
(1)>1
Receive polarity:
 1. Idle 1 *default
 2. Idle 0
(1)>1
Select output type:
 1. Open drain (H=Hi-Z, L=GND)
 2. Normal (H=3.3V, L=GND)

(1)>2
Ready
================ Start spamming the camera with repeating '#' byte ============
UART>0x23:99999
========== press, and keep pressing  the ON/OFF button ================
========== while the button is kept pressed, insert the battery =======
WRITE: 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x
========== spamming is ended, release ON/OFF  button =========
========== start to talk to the camera normally ===========
UART>(1)
UART bridge
Reset to exit
Are you sure? y

>> ?

 ?              Help
 h              Help
 d <adr> <size> Dump memory
 e <adr>        Edit memory
 i  adr         Input
 o  adr  data   Output
 q              Quit ( =Reset )
 c              CheckSiP ( don't return! )
 f <adr> <file> File read
 v <source> <target> <size>     Verify memory
--- example ---
        >> d A0000 1B0    ; dump 0xA000-0xA1AF

>> d FC000000 80
FC000000:  0C 45 00 FC 78 46 00 FC 43 F6 C0 70 CF F6 00 40     .E..xF..C..p...@
FC000010:  70 47 00 00 00 BF DF F8 04 D0 70 47 FC FF FF 1F     pG........pG....
FC000020:  00 BF DF F8 04 D0 70 47 E0 FF E1 BF 43 F6 FC 71     ......pG....C..q
FC000030:  8D 46 02 F0 79 BF 00 00 30 B5 89 B0 4F F0 FF 34     .F..y...0...O..4
FC000040:  00 F0 90 F8 03 F0 E2 FC 00 F0 A4 F9 30 48 03 F0     ............0H..
FC000050:  85 FB 05 AB 05 46 00 20 00 93 06 AB 07 AA 08 A9     .....F. ........
FC000060:  03 F0 3A FC 00 F0 9E F8 00 F0 EC F9 03 F0 7C FA     ..:...........|.
FC000070:  75 BB 08 99 01 29 1C D0 03 29 08 D0 06 29 27 D1     u....)...)...)'.
>>
=

i possibly overdid it, and there was some contact problem, but it works.
« Last Edit: 19 / November / 2017, 05:37:36 by hardlock »

Re: UART question: Rescue Loader / UART loopback switch
« Reply #39 on: 19 / November / 2017, 06:25:55 »
i could NOT force it to start the DISKBOOT.bin from a SD card (and I at the moment I can't see initial console messages) but it is a good start.

 

Related Topics