Search

Technical Discussion Group Forum

This forum is provided for user discussion. While Beacon EmbeddedWorks support staff and engineers participate, Beacon EmbeddedWorks does not guarantee the accuracy of all information within in the Technical Discussion Group (TDG).

The "Articles" forums provide brief Articles written by Beacon EmbeddedWorks engineers that address the most frequently asked technical questions.

To receive email notifications when updates are posted for a Beacon EmbeddedWorks product download, please subscribe to the TDG Forum of interest.

TDG Forum

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 11 Oct 2007 04:06 AM by  mikee@logicpd.com
Load bin <stdin>
 8 Replies
Sort:
You are not authorized to post a reply.
Author Messages
jdionne
New Member
New Member
Posts:


--
02 Oct 2007 07:14 AM
    What protocol does load command use to receive the file from the serial port.
    Tera Term Pro 'send file' function just seems to send the file in binary format.

    But when I try the same thing in my application the transfer always fails.

    Is the load command expecting some sort of packet like X-Modem?
    I read the file into a binary array and loop through the array.
    Is there some sort of handshaking going on?

    using 'load bin'

    Thanks
    Jeff
    mikee@logicpd.com
    New Member
    New Member
    Posts:


    --
    06 Oct 2007 09:57 AM
    Jeff,

    Currently, there is no serial protocol handling in LoLo - everything is done using raw reads and writes. So, you are correct that the TeraTerm Send File operation just dumps data over the serial port.

    Of course, there is a chance for LoLo to miss bytes on the serial port using this method - which could cause data corruption. So far, this hasn't been a problem.

    We have looked at adding support for X, Y, and/or Z modem in the next revision of LoLo.

    Regards,
    --mikee
    jdionne
    New Member
    New Member
    Posts:


    --
    09 Oct 2007 08:28 AM
    so why, if I just dumping bytes, does lolo tell me "error: load: file is not in Microsoft NK.bin format (stdin)"
    mikee@logicpd.com
    New Member
    New Member
    Posts:


    --
    09 Oct 2007 12:09 PM
    Are you sending a Microsoft .bin file? Put another way, are you sending a Windows CE (nk.bin) image?

    Sometimes people get confused and think the bin option stands for binary. If you are loading a raw binary file, then you want to use the load raw command.

    Is that the problem you are experiencing?

    --mikee
    jdionne
    New Member
    New Member
    Posts:


    --
    09 Oct 2007 12:19 PM
    As I said in my first post I am using the "Load bin" command and it is a nk.bin file, which works fine with TeraTerm.
    I am trying to do the same thing with in my application.


    thanks
    mikee@logicpd.com
    New Member
    New Member
    Posts:


    --
    09 Oct 2007 04:59 PM
    Well, your first post only said that you were using the load bin command, not that you were actually using it correctly It isn't uncommon for customers to mistakingly use load bin to try and load raw binary files. I've found it is always best to rule out everything if possible.

    That being said, I guess I have no idea what is wrong with your program. Perhaps you have a timeout condition, perhaps you are overflowing the serial port buffer on the development machine and bytes are being dropped, perhaps you are sending the wrong number of data bits or stop bits. I really can't say other than if TeraTerm is working, it isn't likely to be a problem with LoLo. For the above items, I would probably take a hard look at your COM-port initialization routines/structures.

    LoLo just reads bytes off the wire as fast as it can. No hardware flow control, no software flow control, no transfer protocol. Just raw data.

    Maybe you can echo the first chunk of data that you send to STDOUT as well as the serial port. Then look at or post that. I assume that you read the .bin file format section of the Platform Builder help file. This error probably happened pretty quick in the transfer as LoLo likely didn't see the proper master .bin header. So snooping the data you are sending would help us verify that at least your code's logic is correct.

    In fact, try dumping your array to STDOUT, then use a shell-pipe to reroute your program into a new file, then compare that file to the original nk.bin. They should be identical. If they are, then the error has to lie with how your program is setting up and/or using the development machines serial port. If they aren't, then you've got a logic error someplace.

    Regards,
    --mikee
    jdionne
    New Member
    New Member
    Posts:


    --
    10 Oct 2007 09:24 AM
    Thank you for your help.

    I seem to resolve a little bit. If I break up the file in 1000 byte chunks and send one chunk at a time LoLo seems to respond correctly.

    But when the file reaches the end LoLo seems to be still waiting for something?

    I tried watching what TeraTerm does to the data when is sends a binary file, it doesn't seem to send any extra byte to signal the end of file.
    Any clues on what LoLo might still be waiting for? Does the nk.bin file have some sort of size field that LoLo reads and for some reason a byte was just dropped. I also notice that TeraTerm sends 100 byte chucks at a time, is LoLo capable of handling the 1000 byte chuck?
    jdionne
    New Member
    New Member
    Posts:


    --
    10 Oct 2007 01:48 PM
    thanks for the help, I got it to work. You were right it was a logic error
    I was over writing the 100 byte in the chunck and then adding a byte at the end.
    mikee@logicpd.com
    New Member
    New Member
    Posts:


    --
    11 Oct 2007 04:06 AM
    Jeff,

    Congratulations! I'm very glad it worked out for you.

    Good luck with the rest of your project and keep us posted on your progress.

    Cheers,
    --mikee
    You are not authorized to post a reply.