{"id":829,"date":"2012-03-28T10:53:37","date_gmt":"2012-03-28T02:53:37","guid":{"rendered":"http:\/\/www.computersolutions.cn\/blog\/?p=829"},"modified":"2012-03-31T12:32:10","modified_gmt":"2012-03-31T04:32:10","slug":"king-of-game-jamma-board-reverse-engineering","status":"publish","type":"post","link":"https:\/\/www.computersolutions.cn\/blog\/2012\/03\/king-of-game-jamma-board-reverse-engineering\/","title":{"rendered":"King of Game JAMMA Board reverse engineering"},"content":{"rendered":"<p>As visitors to my office have noticed, we&#8217;ve been building a bunch of arcade machines for clients.<br \/>\nHere are a couple of pics of the builds in progress:<\/p>\n<p>Chassis&#8217;s undergoing painting<br \/>\n<img decoding=\"async\" src=\"http:\/\/farm8.staticflickr.com\/7277\/6865112392_dd3ca8f8ba.jpg\"><\/p>\n<p>Unfinished machine<br \/>\n<a href=\"http:\/\/www.flickr.com\/photos\/sheedl\/6840355354\/\" title=\"Untitled by sheedl, on Flickr\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/farm8.staticflickr.com\/7043\/6840355354_2335610d97.jpg\" width=\"500\" height=\"500\" alt=\"\"><\/a><\/p>\n<p>While making those is fun, I also have an interest in what powers them.<\/p>\n<p>Arcade Machines are really just a wooden box, a display, a controller board, input (buttons and joysticks), and a PSU, they&#8217;re pretty basic devices.  There is an industry cabling standard &#8211; JAMMA which makes connecting them up nice and easy.  <\/p>\n<p>China has a number of hardware choices for powering them, ranging from PC based boards, original arcade boards, and what I think is the better solution for older games &#8211; emulation under embedded ARM\/MIPS, vs dedicated boards.<\/p>\n<p>We went through a number of different versions of hardware available here until I found something I liked.<\/p>\n<p>Our currently build hardware du jour runs off of something called &#8220;King of Game&#8221;.<br \/>\nAs is usual in China, no documentation, and the factory is less than forthcoming with information.<\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/sheedl\/7022629041\/\" title=\"King of Arcade by sheedl, on Flickr\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/farm8.staticflickr.com\/7100\/7022629041_3a71a5b46d.jpg\" width=\"500\" height=\"500\" alt=\"King of Arcade\"><\/a><\/p>\n<p>Still, not unusual.<\/p>\n<p>The device does have some interesting features for the would be hacker &#8211; <\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/sheedl\/7022744283\/\" title=\"Untitled by sheedl, on Flickr\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/farm7.staticflickr.com\/6042\/7022744283_d9e7ff9433.jpg\" width=\"500\" height=\"500\" alt=\"\"><\/a><\/p>\n<p>It has a nicely labelled &#8220;Boot&#8221; button, and the component count is quite low.  Which generally means its SoC (System on a Chip) based.<br \/>\nThe factory has done a little bit of prep work in making sure us ev1l hackorz won&#8217;t get at the juicy bits by etching off the cpu.<\/p>\n<p>A quick look at the chip pin count, and the usual choice of chipset SoC more or less got me the right answer in a few minutes though.<\/p>\n<p>My guess was Ingenic 4850, and it turned out to be the Ingenic 4755.  This is a MIPS based X-Burst CPU<\/p>\n<p>Even though they&#8217;re  Chinese vendor, Ingenic does a great job in providing readily available information about their chipset(s).  Kudos to the Ingenic guys in Beijing for being so open!<\/p>\n<p>Datasheets for the 4755 and more importantly toolchains are readily available at the Ingenic FTP site &#8211; <a href=\"ftp:\/\/ftp.ingenic.cn\/2soc\/4750\">ftp:\/\/ftp.ingenic.cn\/2soc\/4750<\/a><\/p>\n<p>Back to the board.<\/p>\n<p>The King of Game board has USB onboard.<br \/>\nPlugging it into a computer shows the flash files available, but unfortunately not the firmware bits I need to see \/ change (e.g. to upgrade emulator capabilities, and change graphics).<\/p>\n<p>If I hold down boot and plug in the USB, I get prompted for the Ingenic 4750 drivers.<br \/>\nThose are relatively easy to find on the ingenic site, so get a hold of those yourselves.<\/p>\n<p>In order to connect to the board, you use a USB_BOOT.exe (there are also Linux tools available).<br \/>\nI downloaded usbboot-1.4b <a href='http:\/\/www.computersolutions.cn\/blog\/wp-content\/uploads\/2012\/03\/usbboot1.4b-tools.rar'>usbboot1.4b-tools<\/a>, and unzipped that.<\/p>\n<p>The USB Boot file needs a config file though &#8211; and the default config files supplied didn&#8217;t work \ud83d\ude41<\/p>\n<p>So, off to check what could be up.<\/p>\n<p>The USB_Boot utility requires a bunch of settings in order to communicate with a board.  After a bit of fiddling playing around with possible options I got it talking to the board.<br \/>\nWhile I&#8217;m not certain I have the settings completely correct here is what I have right now:<\/p>\n<p><code><\/p>\n<p>[PLL]<br \/>\nEXTCLK\t\t\t24\t\t\t;Define the external crystal in MHz<br \/>\nCPUSPEED\t\t336\t\t\t;Define the PLL output frequency<br \/>\nPHMDIV\t\t\t3\t\t\t;Define the frequency divider ratio of PLL=CCLK:PCLK=HCLK=MCLK<br \/>\nBOUDRATE\t\t57600\t\t\t;Define the uart boudrate<br \/>\nUSEUART\t\t\t0\t\t\t;Use which uart, 0\/1 for jz4740,0\/1\/2\/3 for jz4750<\/p>\n<p>[SDRAM]<br \/>\nBUSWIDTH\t\t16\t\t\t;The bus width of the SDRAM in bits (16|32)<br \/>\nBANKS\t\t  \t4\t\t\t;The bank number (2|4)<br \/>\nROWADDR\t  \t\t12\t\t\t;Row address width in bits (11-13)<br \/>\nCOLADDR\t  \t\t9\t\t\t;Column address width in bits (8-12)<br \/>\nISMOBILE\t  \t0\t\t\t;Define whether SDRAM is mobile SDRAM, this only valid for Jz4750 ,1:yes 0:no<br \/>\nISBUSSHARE\t  \t1\t\t\t;Define whether SDRAM bus share with NAND 1:shared 0:unshared<\/p>\n<p>[NAND]<br \/>\nBUSWIDTH\t\t8\t\t\t;The width of the NAND flash chip in bits (8|16|32)<br \/>\nROWCYCLES\t\t3\t\t\t;The row address cycles (2|3)<br \/>\nPAGESIZE\t\t2048\t\t\t;The page size of the NAND chip in bytes(512|2048|4096)<br \/>\nPAGEPERBLOCK\t\t64\t\t\t;The page number per block<br \/>\nFORCEERASE\t\t0\t\t\t;The force to erase flag (0|1)<br \/>\nOOBSIZE\t\t\t64\t\t\t;oob size in byte<br \/>\nECCPOS         \t\t6\t\t\t;Specify the ECC offset inside the oob data (0-[oobsize-1])<br \/>\nBADBLACKPOS     \t0\t\t\t;Specify the badblock flag offset inside the oob (0-[oobsize-1])<br \/>\nBADBLACKPAGE    \t127   \t\t\t;Specify the page number of badblock flag inside a block(0-[PAGEPERBLOCK-1])<br \/>\nPLANENUM\t\t1\t\t\t;The planes number of target nand flash<br \/>\nBCHBIT\t  \t\t4\t\t\t;Specify the hardware BCH algorithm for 4750 (4|8)<br \/>\nWPPIN\t\t\t0\t\t\t;Specify the write protect pin number<br \/>\nBLOCKPERCHIP\t\t0\t\t\t;Specify the block number per chip,0 means ignore<\/p>\n<p>[END]<br \/>\n<\/code><\/p>\n<p>If I put the board into USB boot mode (hold down boot button, and plug into the usb), then run the USB_TOOL.EXE file I can communicate<\/p>\n<p><code><br \/>\n Welcome!<br \/>\n USB Boot Host Software!<br \/>\n USB Boot Software current version: 1.4b<br \/>\n Handling user command.<br \/>\n USBBoot :> list<\/p>\n<p> Device number can connect :1<br \/>\n USBBoot :> help<\/p>\n<p> Command support in current version:<br \/>\n help          print this help;<br \/>\n boot          boot device and make it in stage2;<br \/>\n list          show current device number can connect;<br \/>\n fconfig       set USB Boot config file;<br \/>\n nquery        query NAND flash info;<br \/>\n nread         read NAND flash data with checking bad block and ECC;<br \/>\n nreadraw      read NAND flash data without checking bad block and ECC;<br \/>\n nreadoob      read NAND flash oob without checking bad block and ECC;<br \/>\n nerase        erase NAND flash;<br \/>\n nprog         program NAND flash with data and ECC;<br \/>\n nmark         mark a bad block in NAND flash;<br \/>\n go            execute program in SDRAM;<br \/>\n version       show current USB Boot software version;<br \/>\n exit          quit from telnet session;<br \/>\n readnand      read data from nand flash and store to SDRAM;<br \/>\n load          load file data to SDRAM;<br \/>\n run           run command script in file;<br \/>\n memtest       do SDRAM test;<br \/>\n gpios         let one GPIO to high level;<br \/>\n gpioc         let one GPIO to low level;<br \/>\n sdprog        program SD card;<br \/>\n sdread        read data from SD card;<br \/>\n USBBoot :> boot<\/p>\n<p> Usage: boot (1)<br \/>\n 1:device index number<br \/>\n USBBoot :> boot 0<\/p>\n<p> Checking state of No.0 device: Unboot<br \/>\n Now booting No.0 device:<br \/>\n Download stage one program and execute at 0x80002000: Pass<br \/>\n Download stage two program and execute at 0x80c00000: Pass<br \/>\n Boot success!<br \/>\n Now configure No.0 device:<br \/>\n Now checking whether all configure args valid:<br \/>\n Current device information: CPU is Jz4750<br \/>\n Crystal work at 24MHz, the CCLK up to 336MHz and PMH_CLK up to 112MHz<br \/>\n Total SDRAM size is 16 MB, work in 4 bank and 16 bit mode<br \/>\n Nand page size 2048, ECC offset 6, bad block ID 127, use 1 plane mode<br \/>\n Configure success!<br \/>\n<\/code><\/p>\n<p>Next up, read the firmware off the flash, and dump it to see which version of the Dingoo code they most probably ripped off \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As visitors to my office have noticed, we&#8217;ve been building a bunch of arcade machines for clients. Here are a couple of pics of the builds in progress: Chassis&#8217;s undergoing painting Unfinished machine While making those is fun, I also have an interest in what powers them. Arcade Machines are really just a wooden box, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[390,282],"tags":[537,392,391,393],"class_list":["post-829","post","type-post","status-publish","format-standard","hentry","category-arcade-machines","category-firmware-2","tag-arcade-machines","tag-arm","tag-jamma","tag-reverse-engineering"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/posts\/829","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/comments?post=829"}],"version-history":[{"count":8,"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/posts\/829\/revisions"}],"predecessor-version":[{"id":838,"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/posts\/829\/revisions\/838"}],"wp:attachment":[{"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/media?parent=829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/categories?post=829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/tags?post=829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}