Rockbox Development > New Ports
SanDisk Sansa c200v2, m200v4, clipv1, clipv2, clip+, and fuzev2
atomikpunk:
Hi Daniel (and everyone),
well there is at least one thing I see missing in your code: you should enable the GPIO module clock. This is done via the CGU_PERI register which is at 0xC80F0014 via bit 16 (0x10000). Be sure to read CGU_PERI, logical _OR_ (damnit) bit 0x10000 with the register content, and then write back to this register...
For my m200 special mode, I'm still clueless why it won't show up a drive. I'm wondering if my ext. mem. firmware is ran before the special mode bootloader... That could explain why the flash is still not found but I wonder how come the firmware would get executed before turning to the bootloader... Anyone got an idea on this?
(damn time zones... if only you guys were from americas ;D)
Francois
daniel_at:
Hello thread,
Just played a bit again with my v2. Thx, atomikpunk for the hint with the Clock-Init. The datasheet did not mention it near the GPIO-docu, but some pages apart... Havent planned to read the whole pdf :)
now my Code looks like this:
--- Code: ---/* This value is filled in by mkamsboot */
originalentry: .word 0
.equ AS3525_GPIO1_BASE, 0xC80B0000
.equ GPIO1_DATA, (AS3525_GPIO1_BASE+0x0000)
.equ AS3525_GPIO3_BASE, 0xC80D0000
.equ GPIO3_DATA, (AS3525_GPIO3_BASE+0x0000)
.equ CGU_PERI,0xC80F0014
.equ AS3525_I2C_AUDIO_BASE, 0xC8070000
.equ SYSTEM_REG, (AS3525_I2C_AUDIO_BASE+0x20)
/* enable the GPIO-Clock */
ldr r1, =CGU_PERI
ldr r0,[r1]
orr r0,r0,#(1<<16)
str r0,[r1]
/* A delay loop - just to prove we're running */
mov r1, #0x500000 /* Approximately 5 seconds */
loop:
/* check register */
ldr r2, =GPIO1_DATA
ldrb r2, [r2] /* Load GPIOC-Data into r1 */
tst r2, #0x80 /* check if .. is set */
/*cmp r2,#0*/
bne noloop
subs r1, r1, #1
bne loop
/* Now branch back to the original firmware's entry point */
noloop: ldr pc, originalentry
--- End code ---
(Test now in the loop - maybe to circumvent timing problems)
Tried all 8 bitmasks for GPIO1 (which is hopefully GPIOA): no reaction to keypresses - every time it waits the ~5 seconds.
Maybe one problem: Measured the voltage on the switches again - one side is always ground the other one:
* After power on, but in the wait-loop: 1.9V
* If the Sansa-Bootscreen appears and in normal mode: 3V
* In normal mode, but screen (and blue leds) switching off: 0.5V
But even with from that mode (with 0.5V) the sansa can detect keypresses.
(But i have measured with a slow DMS - maybe the keys are tested only for a short periode of time, and the DMS integrates over it... Will test again with oscilloscope some time)
Not sure what that means... but maybe there are some pullups or some powermanagment stuff to enable.
atomikpunk:
Hi again,
Well I'm looking at the e200 code at the moment and it doesn't seem to have any "keypad scanning" routine, at least not as easily visible. There seems to be GPIOB pin 6 which is read in the routine at 0x851C and then its value is used a little later in that same routine. If the pin is high, then memory variable at 0x2181E is put to 1. If the pin is low, then that same memory variable is unchanged. Could that be the hold button?
Here is a list of the pins, direction (input or output) and routine address(es) where it is used, that could give a clue which one to test...
PinDirUsage in codeA0out0x1FD8, 0x1FF8A1in & out0x851C, 0x8720A2in0x6728A3out0x4418A4out0x72DAA5out0x442C (which seems to be the LCD init routine BTW...A6n/aUnusedA7out0x442C (but strange enough since it is only cleared once and not used again...)B0n/aUnusedB1outA lot of routines
To be continued... (somewhat sooner than midnight ;D)
atomikpunk:
Well a big news for today: I got JTAG to work on my M200!!! ;D
Hardware: Wiggler clone as shown in here. However, I needed to add a 10k pull-up resistor between VCC and the RST JTAG line.
Software: H-JTAG, which is a free and very nice windows JTAG interface for debuggers. What is nice about it is that it can auto-detect connected targets. This way, it was easy to know when I got it right because instead of the "unable to detect target" message I was constantly getting, I got the "ARM922T" display in big blue characters.
The JTAG pins on the M200 are (as expected) as noted on the PCB. Beginning from the VCC pin, we have:
VCCTRSTTDITMSTCLKTDOGND
You can get a better view with this picture.
So what's next? Install the winarm toolkit and try to debug this thing. If I can debug that thing and insert my own instructions, that would make my day (because I could recover my bricked m200 ;D)
pedrov:
Hi all,
I just bought a sansa v2 (e280), and feel a bit disappointed about the current firmware; so I'm interesting in helping to port rockbox on these devices. I read this thread, and I was impressed by what has already been discovered. Well done !
I used hachoir (a tool to discover subfiles into files), and I got this :
--- Code: ---% hachoir-subfile e200pe.bin
[+] Start search on 15728640 bytes (15.0 MB)
Search: 19.58% -- offset=3080192 (2.9 MB)
[+] File at 3812522 size=21872 (21.4 KB): PNG picture: 256x256x8
[+] File at 3834394 size=2341 (2341 bytes): PNG picture: 132x32x8
[+] File at 3865319 size=52475 (51.2 KB): PNG picture: 256x256x32 (alpha layer)
[+] File at 3917794 size=3882 (3882 bytes): PNG picture: 132x32x32 (alpha layer)
Search: 53.75% -- offset=8454144 (8.1 MB) -- 2.2 MB/sec -- ETA: 3 sec 111 ms
Search: 77.92% -- offset=12255232 (11.7 MB) -- 2.4 MB/sec -- ETA: 1 sec 405 ms
[+] End of search -- offset=15728640 (15.0 MB)
Total time: 6 sec 223 ms -- global rate: 2.4 MB/sec
--- End code ---
By the way these pictures aren't really interesting to extract (sandisk logos, and pictures of the device ...). But since I did not find any mention of them on the firmware wiki page, I thought it would be interesting to mention.
Another thing : I tried to upgrade to a "by-hand" modified firmware (I just changed "HOLD" into "HALD" in a string), but it did not work as expected. Weird, since the checksum program (available into Daniel's wiki) told me that the checksum did not changed. My sansa did not even want to flash itself with this modified version ('Upgrade in progress ...' and then shutdown).
I'm really interested in giving a hand, if I can.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version