Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

Member_14809996

@Member_14809996
About
Posts
5
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Serial port takes a long time to respond
    M Member_14809996

    Hi, Im currently making an app on windows forms trying to program a micro over UART. I can achieve it, although it is taking a long time to carry out the program. I have used stopwatches to determine it is my read function taking up the majority of the time. When i try to read the micros response from each command I have to wait for all of it, which is why im using a while loop in the code below, if the returned message size is not what i expect. What im wondering is, if there is any way to speed up this process. The response from the micro should be pretty fast, its running at a baudrate of 115200, meaning the whole 512 kb file should in theory take just over 30 seconds to complete, at the moment it is more than double that, at 80 seconds.

    private string CheckResponse(int mSize)
    {
    //ComPort.DataReceived += SerialPortDataReceived;

    string response;
    int intBuffer;
    intBuffer = ComPort.BytesToRead;
    byte\[\] byteBuffer = new byte\[intBuffer\];
    ComPort.Read(byteBuffer, 0, intBuffer);
    
    response = Encoding.ASCII.GetString(byteBuffer);
    
    while(response.Length != mSize)
    {
        intBuffer = ComPort.BytesToRead;
        byteBuffer = new byte\[intBuffer\];
        ComPort.Read(byteBuffer, 0, intBuffer);
        response += Encoding.ASCII.GetString(byteBuffer);
    }
    
    return response;
    

    }

    Any help greatly appreciated. Blair

    Hardware & Devices winforms performance help

  • Serial port takes a long time to respond
    M Member_14809996

    Hi, Im currently making an app on windows forms trying to program a micro over UART. I can achieve it, although it is taking a long time to carry out the program. I have used stopwatches to determine it is my read function taking up the majority of the time. When i try to read the micros response from each command I have to wait for all of it, which is why im using a while loop in the code below, if the returned message size is not what i expect. What im wondering is, if there is any way to speed up this process. The response from the micro should be pretty fast, its running at a baudrate of 115200, meaning the whole 512 kb file should in theory take just over 30 seconds to complete, at the moment it is more than double that, at 80 seconds.

        private string CheckResponse(int mSize)
        {
            //ComPort.DataReceived += SerialPortDataReceived;
    
            string response;
            int intBuffer;
            intBuffer = ComPort.BytesToRead;
            byte\[\] byteBuffer = new byte\[intBuffer\];
            ComPort.Read(byteBuffer, 0, intBuffer);
    
            response = Encoding.ASCII.GetString(byteBuffer);
    
            while(response.Length != mSize)
            {
                intBuffer = ComPort.BytesToRead;
                byteBuffer = new byte\[intBuffer\];
                ComPort.Read(byteBuffer, 0, intBuffer);
                response += Encoding.ASCII.GetString(byteBuffer);
            }
    
            return response;
        }
    

    Any help greatly appreciated. Blair

    Algorithms winforms performance help

  • How to get faster serial port data transfer on windows forms
    M Member_14809996

    So i think you are right, i downloaded a serial port sniffer and have determined the data from a 1024 buffer needs to be written in a queue of 45 bytes at a time to allow the micro to process it. Any idea how i would begin to do this? or a link to an example? Many thanks, Blair

    Algorithms csharp winforms adobe performance tutorial

  • How to get faster serial port data transfer on windows forms
    M Member_14809996

    So I've replaced the two write to RAM functions with just one that writes all 1024 bytes of RAM instead which has saved some time, although i'm still way off where i should be with my timing.

    Algorithms csharp winforms adobe performance tutorial

  • How to get faster serial port data transfer on windows forms
    M Member_14809996

    Hi all, I have been working on uploading a .bin file to a micro with basically a hello world project inside. Although i find that it could definitely be faster when uploading the contents of the file to the micros ram, where it then copies it to flash. Where this data is transferred is located in the code below: for (int i = 0; i < Page.numPages; i++) { Write2Ram("536871680", "512"); ComPort.Write(code, start_Address_Code, 512); Write2Ram("536872192", "512"); ComPort.Write(code, start_Address_Code + Page.ram_Size, 512); copy2Flash(flash_Address, "536871680", "1024"); int_Address = int.Parse(flash_Address); flash_Address = (int_Address + Page.flash_Size).ToString(); start_Address_Code += Page.flash_Size; backgroundWorker1.ReportProgress(0); } Is there anything that sticks out that could be improved for speed? Increasing the baud rate increases the speed for sure, but not as quickly as some other applications are capable of and i dont really understand why. This is my first windows forms project and i am a little new to C#. @ 460800 baud rate it currently takes 60 seconds to upload a roughly 500kb file. Many thanks, Blair

    Algorithms csharp winforms adobe performance tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups