Wednesday, March 30, 2011

New bootloader, Win32 support

Although there was a preliminary programmer for win32, I only recently realised that win32 does not actually support natively serial speeds above 256Kbaud. This stroke me as very odd, we're on the 21th century now, with advent of serial links not rs232-based (like USB serial controllers) having speeds of 1Mbaud, 3Mbaud or even higher is very common, it's weird why Microsoft did not expand its baudrate selection to higher speeds.

Anyway.

So to support win32, we've to get that speed down, so I decided on a two-steps approach. We can initially talk to ZPUino at a reasonably lower speed (115200), and then depending on OS and eventually board features rise this speed to something more acceptable (which would be 1/3Mbaud on Unices, 256Kbaud on Windows). This requires changes to bootloader and to programmer which I am ultimating as I write.

Also for win32 support we need the compilers. Those are building now, if everything goes well I hope full win32 support will be on next Alpha version (which, by the way, will be due this weekend). The programmer already has a fix for the insane command line processing in mingw32 (or is it msvc?), so everything seems to be on rails.

Alvie

4 comments:

  1. HOW TO SET SERIAL BAUDRATE to any value in Win32

    1.use a DCB structure
    2.call GetCommState
    3.set BaudRate field, I tested 1.5mbaud and it works
    4.call SetCommState

    Have fun.

    ReplyDelete
  2. Thanks for the tip, Victor, but it at least does not work for me in Windows XP home. At least not 1Mbit (gives error 87 - ERROR_INVALID_PARAMETER). I've sent you some more questions by e-mail.

    Alvie

    ReplyDelete
  3. Hello Alvie
    It's weird you are not able to use higher baudrates under WindowsXP.
    I manage to set Putty to 3000000 bauds and succesfully communicate with eg: my papilio FPGA board which sports an FTDI UART that supports upto 3Mbps.
    And it works fine ! I can send/receive ascii bytes within the terminal and the papilio reacts accordingly
    I use WindowsXP SP2 (LSD)

    ReplyDelete
  4. I don't know if it will help, but here is a portmon dump of the Putty serial port 2Mbps setting up :

    0.04234253 putty.exe IRP_MJ_CREATE VCP1 SUCCESS Options: Open
    0.00000419 putty.exe IOCTL_SERIAL_GET_BAUD_RATE VCP1 SUCCESS
    0.00000223 putty.exe IOCTL_SERIAL_GET_LINE_CONTROL VCP1 SUCCESS
    0.00000168 putty.exe IOCTL_SERIAL_GET_CHARS VCP1 SUCCESS
    0.00000168 putty.exe IOCTL_SERIAL_GET_HANDFLOW VCP1 SUCCESS
    0.00000223 putty.exe IOCTL_SERIAL_GET_BAUD_RATE VCP1 SUCCESS
    0.00000168 putty.exe IOCTL_SERIAL_GET_LINE_CONTROL VCP1 SUCCESS
    0.00000140 putty.exe IOCTL_SERIAL_GET_CHARS VCP1 SUCCESS
    0.00000168 putty.exe IOCTL_SERIAL_GET_HANDFLOW VCP1 SUCCESS
    0.00270006 putty.exe IOCTL_SERIAL_SET_BAUD_RATE VCP1 SUCCESS Rate: 2000000
    0.00204551 putty.exe IOCTL_SERIAL_SET_RTS VCP1 SUCCESS
    0.00598679 putty.exe IOCTL_SERIAL_SET_DTR VCP1 SUCCESS
    0.00288640 putty.exe IOCTL_SERIAL_SET_LINE_CONTROL VCP1 SUCCESS StopBits: 1 Parity: NONE WordLength: 8
    0.00000223 putty.exe IOCTL_SERIAL_SET_CHAR VCP1 SUCCESS EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13
    0.00294507 putty.exe IOCTL_SERIAL_SET_HANDFLOW VCP1 SUCCESS Shake:1 Replace:40 XonLimit:2048 XoffLimit:512
    0.00000223 putty.exe IOCTL_SERIAL_SET_TIMEOUTS VCP1 SUCCESS RI:1 RM:0 RC:0 WM:0 WC:0
    0.00000000 putty.exe IRP_MJ_READ VCP1 Length 1
    0.00066042 putty.exe IRP_MJ_WRITE VCP1 SUCCESS Length 1: 68
    0.00066433 putty.exe IRP_MJ_WRITE VCP1 SUCCESS Length 1: 65
    0.00067104 putty.exe IRP_MJ_WRITE VCP1 SUCCESS Length 1: 6C
    0.00067355 putty.exe IRP_MJ_WRITE VCP1 SUCCESS Length 1: 6C
    0.00069031 putty.exe IRP_MJ_WRITE VCP1 SUCCESS Length 1: 6F

    ReplyDelete