Updates from January, 2010 Toggle Comment Threads | Keyboard Shortcuts

  • charliex 1:13 am on January 3, 2010 Permalink | Reply
    Tags: cadsoft eagle, eagle, , script   

    My Cadsoft Eagle tips 

     

    Just some notes mainly for myself as I get into some of the finer points of Eagle, for instance I had a schematic that had been revised and no board, the previous version had both but there were enough changes to make it a hassle. So I figured script it, Eagle has a decently powerful scripting interface. Most of the things I end up trying to figure out involve changing existing laid out board to be suitable for my AccurateCNC 560 and PCB process.

    There might and probably is a better way to do most of these, but that is partially why I’m putting up an entry.

    I use the Sparkfun CAM (from http://www.opencircuits.com ) as starting off point,my DRC generally has 8mil min sizes and 31 mil minimum drill for via’s which is huge. Sparkfun also have their library available, but it has conflicting information for commercial use.

     

    Script/command line

    rotate =MR90 LED1  rotates and mirrors LED1 regardless of starting position, M=mirror
    move LED1 ( 1.0 1.0 )  moves LED1 to 1.0 1.0
    info LED1  equivalent to properties
    show LED1 same as clicking with the mouse

     

    Changing VIA sizes after the board has been laid out, without ripping up

    I have some via rivets LPKF EasyContac , the smallest has an outer diameter of 31mil , most board via’s are much smaller, so I wanted a way to resize them. I did the DRC, switched off some of the layers, then just clicked through them.

    change drill value

    Obviously the downside is that the changed Via may now overlap or cause routing problems, sod’s law will guarantee it. Its funny how the smallest of changes will throw off an entire board, the knock on effect can make it go from i just need to resize that one via, to the whole board has to be rerouted.

    I’d hoped this would do it, but alas no. From a cursory glance over other scripts, you generate a cmd that does the changes. I just have to figure out how to select the via I want to change.

    B.signals(S) {
      S.vias(V) {
         if( V.drill < drillminsize ) {
                  V.drill = drillminsize;
          }
         }
      }

    So this is where i went with it

     

    #usage "<b>Export size and position information from a board to a script.</b>\n"
           "<p>"
           "<author>Author: Charlie Wallace</author>"

    // THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED

    real u2u(int x) { // resolution 1/100 mm
       x = round(x * 100)/100;
       return u2mm(x);  // if mm
    }

    real u2ang(real x) {
      if (x > 360)
         x = x -360;
      x = round(x * 10)/10;
      return x;
    }

    if (board) board(B) {

              output("test.scr","wt") {   

            // switch to metric
            printf("grid mm\n");

            // iterate elements
            B.elements(E) {
                printf("move %s (%g %g)\n",E.name,u2u(E.x),u2u(E.y));
                if( E.mirror )
                    printf("mirror %s\n",E.name);
             }
        }
    }

    else dlgMessageBox("Start this ULP in a Board!", "OK");
    exit (0);

     

    First problem is that it uses a fixed name and path for the scr, second is that the mirror is a flip flop not an absolute. I’ll go over the existing parts first

    the real u2u…just converts eagles units to mm, easy enough i copied it from one of the existing scripts, same for the u2ang().

    if (board) board(B)

    this checks to see if we’re in a board, and then starts an iterator for all the boards in B. its like a for loop that makes B point to each instance of the board.

    output("test.scr","wt") {   

    this creates an output file called test.scr with “wt” as write text, C programmers that are familiar with fopen will notice the similarities. Eagle uses {} instead of fopen/fclose style, that is that the file will remain open for writing within the { } .  as with fopen this overwrites anything that already exists.

              // switch to metric
            printf("grid mm\n");

     

    we’re using metric positions, easy enough, this outputs the a line by itself to test.scr that just says

    grid mm

    next is  

         B.elements(E) {

     

    this iterates each of the elements in the board, look at E_ELEMENTS in the eagle help manual for all the members

                  printf("move %s (%g %g)\n",E.name,u2u(E.x),u2u(E.y));
                if( E.mirror )
                    printf("mirror %s\n",E.name);

     

    this prints out a move and maybe mirror ( if the part is mirrored) with the internal eagle units converted to mm so it appears as

    move R1 (1.0 1.0)

    that is basically it! it was faster for me to learn eagle scripting and write this, than it was doing an info, show, and typing in the coords by hand for 50+ components.

     

    Next is to fix the mirror issue. After a quick grep of the help file for ‘mirror’ we see that the rotate is able to set the absolute, which is great since we need to add rotation as well. angle is the member in the UL_ELEMENT structure we need for the rotation, so :-

     

            if(E.mirror)
                printf("rotate =MR%g %s\n",E.angle,E.name);
            else
                printf("rotate =R%g %s\n",E.angle,E.name);

             }

    That adds the rotation and the absolute mirror, it doesn’t deal with multiple layers.

    As its stands now, it needs a file requestor dialog for the script, and to support layers. But it worked (for the most part) for what I needed. Oddly enough one of the components refuses to accept a rotation or mirror, it’ll move but that’s it. Even by command line, have to investigate that one, it certainly helped me transfer the board, but it needs work.

    #usage "<b>Export size and position information from a board to a script.</b>\n"
           "<p>"
           "<author>Author: Charlie Wallace</author>"

    // THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED

    real u2u(int x) { // resolution 1/100 mm
       x = round(x * 100)/100;
       return u2mm(x);  // if mm
    }

    real u2ang(real x) {
      if (x > 360)
         x = x -360;
      x = round(x * 10)/10;
      return x;
    }

    if (board) board(B) {

              output("test.scr","wt") {   

            // switch to metric
            printf("grid mm\n");

            // iterate elements
            B.elements(E) {
                printf("move %s (%g %g)\n",E.name,u2u(E.x),u2u(E.y));
            if(E.mirror)
                printf("rotate =MR%g %s\n",E.angle,E.name);
            else
                printf("rotate =R%g %s\n",E.angle,E.name);

             }
        }
    }

    else dlgMessageBox("Start this ULP in a Board!", "OK");
    exit (0);

     

    Polygon pours usually make for easier routing (as well as the normal benefits)

    At the least this has been true for the boards I’ve been working on, having a common GND plane has made it much easier to route, the bonus being that you don’t have to work about the excess copper on the PCB during CNC too. Initially I’d been using PhCNC to do copper removal which looks nice and might help with assembly due to clearances, swarf and shorts during soldering but it takes a while to do and it eats up expensive end mills

     

    Autorouter as a tool

    Autorouters are a much maligned process, but its simple enough they’re a tool that may help with a process, not a solution for every situation. I use it to help me layout and then individually route, I find routing some of the harder parts by hand helps the auto routing a lot. Artistic style is one thing, but just like source code the pretty formatted code can still be buggy, it just makes more pleasing to humans, in circuits that is what schematics are usually for. Read up on all the right angle stuff, then find the papers where people have actually measured it and determine if your circuit needs it, granted habits are good but no need to go crazy but importantly learn why. Bunny over at Chumby Studios throws out some excellent tips. Engineers tend to be a bit overly obsessive, that is why they often ship late.

    Don’t expect to the auto router to make pcb’s like you see on professional boards, it’s just not going to happen, but if you help it along a bit you’ll get good results. The usual horses for courses rule applies.

     

    Multiple Monitors

    Probably one of the best investments you can make, I like the Hannspree 28’s cheap and cheerful, Schematic on one, board on the other (and a third smaller one for the blog ! )

     
  • charliex 2:23 am on December 28, 2009 Permalink | Reply
    Tags: binary grep, hyundai genesis   

    Hyundai Genesis, December pictures 

    IMG_1146

    I spent most of December hacking away on the Genesis ECU, did pretty well with it, its turned over to the dyno and mechanical guys now ! My stupid iPhone failed miserably at retaining the pictures I took, seem its falls apart if you take too many.

     

    I spent a lot of time in the Hotel, gave me an opportunity to work on the OBD II reflash code. Considering it looked like this outside, a good thing!

    IMG_1158 

    A few days before the snow

    IMG_1149 

     

    My car getting a few mods.

    IMG_1167

     

    Setting up a ram tracer

    IMG_1140

     

    Messing about with the scooby ecu’s, I threw together a little board to flash them.

    Test ‘jig’

    IMG_1112 \

     

    This is one of the three or four boxes of Toyota ECU’s I have.

    IMG_1110

     

    I came across tmbinc’s bgrep and modified it a bit to run natively under windows (rather than cygwin), the recurse directory code is just from msdn, I didn’t spent a lot of time with it. Binary grep is very useful, i keep meaning to write one. i didn’t test the stdin.

    // Written in April 2009 by Felix Domke <tmbinc@elitedvb.net>
    //
    // Placed in the public domain April 2009 by the author: no copyright is
    // claimed, and you may use it for any purpose you like.
    //
    // No warranty for any purpose is expressed or implied by the author.
    // Report bugs and send enhancements to the author.

    #include <windows.h>
    #include <stdio.h>
    #include <sys/types.h>

    int ascii2hex(char c)
    {
        if (c < ’0′)
            return -1;
        else if (c <= ’9′)
            return c – ’0′;
        else if (c < ‘A’)
            return -1;
        else if (c <= ‘F’)
            return c – ‘A’ + 10;
        else if (c < ‘a’)
            return -1;
        else if (c <= ‘f’)
            return c – ‘a’ + 10;
        else
            return -1;
    }

    void searchfile(const char *filename, FILE*fd, const unsigned char *value, const unsigned char *mask, int len)
    {
        int o, i;
        off_t offset = 0;
        unsigned char buf[1024];

        if(fd == NULL)  return;

        while (1)
        {
            int r;

            memcpy(buf, buf + len, len);
            r = fread(buf + len, 1,1024 – len,fd);

            if (r < 0)
            {
                perror("read");
                return;
            } else if (!r)
                return;
            for (o = offset ? len : 0; o < r – len + 1; ++o)
            {
                for (i = 0; i < len; ++i)
                    if ((buf[o + i] & mask[i]) != value[i])
                        break;
                if (i == len)
                {
                    printf("%s: 0x%08llx\n", filename, (unsigned long long)(offset + o – len));
                }
            }
            offset += r;
        }
    }

    void recurse(const char *path, const unsigned char *value, const unsigned char *mask, int len)
    {
        BOOL            fFinished;
        HANDLE          hList;
        TCHAR           szDir[MAX_PATH+1];
        TCHAR           szSubDir[MAX_PATH+1];
        WIN32_FIND_DATA FileData;

        // Get the proper directory path
        sprintf(szDir, "%s\\*", path);

        // Get the first file
        hList = FindFirstFile(szDir, &FileData);
        if (hList == INVALID_HANDLE_VALUE)
        {
            printf("No files found\n\n");
        }
        else
        {
            // Traverse through the directory structure
            fFinished = FALSE;
            while (!fFinished)
            {
                // Check the object is a directory or not
                if (FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
                {
                    if ((strcmp(FileData.cFileName, ".") != 0) && (strcmp(FileData.cFileName, "..") != 0))
                    {

                        // Get the full path for sub directory
                        sprintf(szSubDir, "%s\\%s", path,FileData.cFileName);

                        recurse(szSubDir,value,mask,len);
                    }
                }
                else{
                    FILE*fd;

                    sprintf(szSubDir, "%s\\%s", path,FileData.cFileName);
                    fd = fopen(szSubDir,"rb");

                    if(fd){
                        searchfile(szSubDir, fd, value, mask, len);

                       printf("%s\n", szSubDir);
                    }
                }

                if (!FindNextFile(hList, &FileData))
                {
                    if (GetLastError() == ERROR_NO_MORE_FILES)
                    {
                        fFinished = TRUE;
                    }
                }
            }
        }

        FindClose(hList);
    }

    int main(int argc, char **argv)
    {
        char*h;
        unsigned char value[0x100], mask[0x100];
        int len = 0;
        if (argc < 2)
        {
            fprintf(stderr, "usage: %s <hex> [<path> [...]]\n<hex> = FFFF, FF or FF??. F, or F?F unsupported, ?? = wildcard\n", *argv);
            return 1;
        }
        h = argv[1];
        while (*h && h[1] && len < 0×100)
        {
            if (h[0] == ‘?’ && h[1] == ‘?’)
            {
                value[len] = mask[len] = 0;
                len++;
                h += 2;
            } else
            {
                int v0 = ascii2hex(*h++);
                int v1 = ascii2hex(*h++);
                if ((v0 == -1) || (v1 == -1))
                {
                    fprintf(stderr, "invalid hex string!\n");
                    return 2;
                }
                value[len] = (v0 << 4) | v1; mask[len++] = 0xFF;
            }
        }
        if (!len || *h)
        {
            fprintf(stderr, "invalid/empty search string\n");
            return 2;
        }
        if (argc < 3) {
            searchfile("stdin", 0, value, mask, len);
        } else
        {
            int c = 2;
            while (c < argc)
                recurse(argv[c++], value, mask, len);
        }

        return 0;
    }

     
    • MrC 10:38 pm on April 19, 2011 Permalink | Reply

      Charliex2,

      Saw your blog on hacking the genesis coupe ecu. How far are you from being able to read and write to the ecu. We’re interesting in a tuning solution for the genesis coupe 2.0T via flash. Let me know if you have any more information regarding the genesis ecu.

      Regards,
      MrC

      • charliex 1:06 am on April 20, 2011 Permalink | Reply

        I did that last year.

  • charliex 4:04 am on December 26, 2009 Permalink | Reply
    Tags: , Xilinx   

    Xilinx ISE update 11.3 –> 11.4 

     

    So a new update appeared for ISE, and I installed it, took about two hours… Worked for about five minutes then failed with the usual Xilinx cryptic message system this one being,  ‘ error message, when i tried to edit the  .v I’d  just created and compiled earlier, refusing to edit the file.

    So i reverted the changes, another hour+ gone, just basically moving/deleting files!, quad core 3 GHz with a 10,000 RPM WD drive under XP. It uses lots and lots of little files, so disable any antivirus you have since it’ll kill the already terrible speed as well as ruin your disk space. Suggest Xilinx look into using a different system, single packed files perhaps ?., works for practically all the video games out there, WAD files etc.. 1000’s of small files is just bad, it always kills performance.

     

    Loading the project back into 11.3 i see it added a ‘timing message to the top of the file (first part of the error message above), so i removed it. Curious to see if that was the cause of the error, I’m reinstalling the patch (which is now downloading again)

     

    This is the uninstaller, fills you with hope doesn’t it! Started off ok, then after about 40% did this. My guess is memory corruption.

    xilinux_1

     

    I’m writing this as i wait for it to reinstall, 15% so far, started at 5:45PM  now 6:10PM, it is around a 2 Gb patch. 40% at 6:28PM (22 Mbps connection). Still at 40% at 6:38PM, and 40% at 6:46PM

     

      I wonder if they have they seen this XKCD comic ?

     

    Still at least I’ve got some episodes of Top Gear and Doctor Who to watch on TiVo. It is December 25th, I just can’t imagine there are many people downloading from xilinx.com and i did a few tests at speedtest.net etc, I’m getting plenty of bandwidth.

     

    Ok finally moved off 40% and now its in the make 100’s of backup folders to copy the existing files into for the rollback. Since the patch is so large it seems to replace just about everything. I’m wondering how long this would take instead ?

    1. recursive zip on all folders in ISE.
    2. delete/replace/add new files

    Or just rename the existing folder to backup_xxx and then install a fresh copy. Even a differential archive shouldn’t take this long. I’m watching it with Filemon from time to time, recursively generating deep directories and copying. We keep our software updates in a content management system like subversion, so you just update to the latest, and you can go back to older versions easily, releases are tagged.

     

    It’s fairly hammering along now thanks to the 10,000 RPM drive. 70% at 6:58PM, but I watched Jeremy Clarkson drive to the North Pole since this started. 79% and its stalled again , since its downloading more data. 83% 7:17 PM, 84%  7:33PM, and this is the second time today I’ve installed it, around 5 hours to install/rollback/reinstall and i don’t know if it’ll work. Woo Hoo 100% at 7:56PM , but whats this ?

    xilinx

     

    Yep 107% its just that awesome. Presumably now its decided to just change files that don’t belong to it, or updating some of my other software. So far its at 126% and its done, well after a reboot. 5:45PM started, 8:03PM finished ( well after the reboot )

     

    I’m curious to know how much of the data being downloaded is actually different.

     

    ISE is just an awful tool. We’re spoiled rotten with C/C++ tools like Developer Studio. FPGA’s are often used because they are fast, the coincidence isn’t lost on me. Best I can think of is, don’t use the updater, delete and redownload it in whole, or just leave it overnight.

     

    Seems to be ok now, I don’t know if I’ll get the original error or not.  ISE crashes very consistently after editing the timing constraints file.

     
  • charliex 5:47 am on November 28, 2009 Permalink | Reply  

    Sump Logic Analyser + omla32, GadgetFactory Butterfly, 

    Just  a quick note if you’re using the omla32+digilient+sump, if it connects but won’t download. then the IDC’s might be jaffed up, they’re real loose on the digilent board. That’s what was wrong with mine at least.

     

    I also picked up http://www.Gadgetfactory.net butterfly to see how it works as an LA, it doesn’t have the same protection as the digilent+omla32 so I’ve done very little with it,except verify it works with a 2V 12.5Mhz square wave.  The digilent is a bit awkward to use off the bench, so this is a lot smaller and it exposes more of the FPGA like the SparkFun board does.

     

     

    Was easy enough to run, plug in USB, upload bitfile and run the Java LA, Jack has included a JRE with it, which is a good idea, smal tip is that the uploader batch file doesn’t work from the command line unless you give it a full path, I’d imagine he’s only ever used it from explorer which always provides a full path.

     

    Slowly wiring up the flash chip, 44 pins!

    fpga_la

     
    • cyphunk 7:28 am on February 19, 2010 Permalink | Reply

      hey can you comment on the flash socket you are using? I’ve looked around but havent found much

      • charlie 3:53 pm on May 17, 2010 Permalink | Reply

        its a meritec tsop 44 flash socket.

  • charliex 6:45 pm on October 20, 2009 Permalink | Reply
    Tags: Altera, , Spartan, WebPack   

    The long way round… 

    I’ve been playing around with FPGA’s, and using Xlinx Spartan 3 from Digilent, I mainly wanted it for the Sump Logic Analyser, but now branching out with it a bit, lets ignore the nightmare install that ISE Webpack is, then the fact that Digilent boards don’t work with the ISE programming tools and focus on the rest of the oddness..

    First off VITAL, this is a library that ought to be in the IEEE lib’s, but for some reason ( possibly being a cut down version of the software,  but if so wouldn’t it be nice if it said so ) . I managed to get this up and running by installing some software that had a VITAL2000 source code ( vhd’s) and adding them to my project as a new library, changed the USE and LIBRARY options to use VITAL2000 and VITAL_timing_2000 ( the lib i have appends _2000 to all of them ) , then its a case of marking some of the functions IMPURE, they’re just warnings so not really needed. XIinx’s website is no good, and their support forum didn’t turn up anything either.

    I even switched to Altera Quartus at one point, but that had similar issues, seems they only have VITAL95 support, and I ran into other issues with it too.

    After that the FMF library needs to be updated to use the new LIBRARY and USE settings… So i finally get to the point where the FMF library compiles, the VITAL2000 compiles, and off it goes to compile the model I’m using, brrp! nope, some mysterious error about ‘Port being unsupported in  a Block concurrent statement’  over on the FMF site someone’s noted it from an old build and the admin is wondering if ISE WebPack is indeed a crippled version.

    updated: uhh i guess you can’t use any of the FMF models for anything but simulation, or vital.. these are good things to learn early on its a core difference with software dev and fpga development!

    As much used to cross development toolsets and so on, the FPGA has been the most difficult and painful route I’ve ever taken, and I’ve worked on some bizarre stuff, the programming itself is easy enough but the dev tools and support are horrible, I guess you just get spoiled by Microsoft’s level of  devtool’s and support.

     

    Anyway my ‘allotment’ for FPGA time is up for today, so I figured jot down a note that i can fill in later., and hoping that the FMF admin will have a solution..

     
  • charliex 2:59 am on October 16, 2009 Permalink | Reply
    Tags: , ,   

    Re-laid out, changed SOIC-16 to SOIC-16DW 

    A360_Test-013_small

    For some reason, which i haven’t checked yet the mill line routed around it, instead of through it, which caused it to be larger. I had this issue once before, last time i used the rectangle tool and this time the line tool, since i wanted a gap, which I set to two 0.05” grid spaces, that was slightly too much. I also cut it a bit deeper when doing the isolation routing. (Adding some notes to older posts: The reason it cut around the trace instead of through it was that the CAM file i was using had the dimension layer and not the milling layer, using the polygon tool on the milling layer fixed it, using a 0 width wire cuts around it)

     

    tooltable

    I built the tool table this time. Which means you get something like this –>

    change_tool

    However I did notice that it refers to T0 which is the bit number in the specific tool list, there are three 1. Isolate 2. Drill and 3. Route. So instead of getting the index from the master tool table, you get the one from the subset. It also counts from 0 for the tool change prompt, but the master Tool Table counts from 1. Also on the isolation rubout, it adds the isolate size to your set, so if you define 3 bits in the drill tool table, it’ll add one ( if its not already included ) and that one will be the isolate bit, usually the V90/60/45

     
  • charliex 2:24 am on October 14, 2009 Permalink | Reply
    Tags: , ,   

    Working Board? Accurate CNC 560 

    Though its got some funky routing :)   and i didn’t quite drill all the way through, this board seems to be right.

     

    A360_Test 011_small

     

    I redesigned it a bit and recut it, a small error in one of the rubout tool changes. The main thing i wanted to get rid of was the trace in the middle left, that cuts through an 0603 package, though on the new one one of the transistors traces is going back under itself. I also scanned this one at  2400DPI, seemed to work better..

    A360_Test 012 copy

     
    • oMG 12:44 am on January 28, 2012 Permalink | Reply

      Hi. How do you remove the material that is not need it? I can do the isolation routing in my pcb but i also want to remove the copper that is not in use and takes a lot of space like you did in the above pictures

      • charliex 12:47 am on January 28, 2012 Permalink | Reply

        end mill of increasing sizes and just remove the parts not wanted.

  • charliex 9:45 pm on October 5, 2009 Permalink | Reply  

    Peek – Target $4.99 

    I just saw this on a shopping trip to target with the parents, A small keyboard/sim card/LCD bearing device for $4.99 … So I bought it, I paid more for the cup of coffee I had waiting for the folks to shop. It’s meant to be an email reader over 3g, subscription service.

     

    This is what I’ve found after a few minutes with Google, Spansion memory, USB but serial to reflash,  TI LoCosto TCS2310/ARM7TDMI + TMS320C54x 104Mhz

    Yet I haven’t seen any actual hacks on it yet, Peek seem to have a closed development list, but i see no further info on it.

     

    company blog

    http://www.geekypeek.com/

     

    make

    http://forums.makezine.com/comments.php?DiscussionID=5609

     

    teardown by ‘the hammer’

    http://forums.makezine.com/comments.php?DiscussionID=5609

    http://hackaday.com/2008/09/15/peek-email-reader-teardown/

    Datasheet link for the Spansion memory ( link from previous link is wrong)

    http://www.spansion.com/Support/Datasheets/s71ns-n_00_a9_e.pdf

     

    TI LoCosto

    http://focus.ti.com/general/docs/wtbu/wtbuproductcontent.tsp?templateId=6123&navigationId=12774&contentId=15407

     

    Interesting TI development device, OMAP though ( $1,299.41 ! )

    http://omapzoom.org/

    uses this 3,6” QVGA

    http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=460-3470-ND

     

    blah once I’d discovered the firmware and JTAG socket, then i came across this page !

    http://peeklinux.com/index.php/Main_Page

     
  • charliex 5:27 pm on October 3, 2009 Permalink | Reply
    Tags: , , PCB bits, Router, ,   

    Accurate CNC , Drill / router bits 

     DSC02200

     DSC02198

    DSC02199

     DSC02201

     
  • charliex 5:05 pm on October 3, 2009 Permalink | Reply
    Tags: , ,   

    Accurate CNC 560 H 

    The first video I made of the machine cutting a PCB. The sharper eyed might notice the bit is the wrong type ( 18 mil drill vs a V bit!)

     

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel
Follow

Get every new post delivered to your Inbox.