CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Bootloader - Updating FW - SIOW works, TeraTerm doesn't
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Milentije89



Joined: 07 Apr 2017
Posts: 31

View user's profile Send private message

Bootloader - Updating FW - SIOW works, TeraTerm doesn't
PostPosted: Mon Apr 05, 2021 6:33 am     Reply with quote

Hi to everyone,

I am encountering really annoying problem.

Uploading HEX file works without a problem when I am using SIOW. New firmware is uploaded without a problem, everything is fine.

But, when I try to upload the same file using TeraTerm, it doesn't work.
Same device, same HEX, same MCP2200 USB-UART board, only difference is terminal software.

Whatever I try to change in TeraTerm it just doesn't work.
XON/XOFF, character/line delay, new line character for TX and RX,... It just doesn't work.

Try SIOW again, it works.

I also tried RealTerm and it doesn't work, just like TeraTerm.

WTF is going on? What am I missing?

When I am using SIOW both TX and RX leds on MCP2200 board are blinking, but when I am using TeraTerm or RealTerm, only TX blinks while RX is turned off.

I am not total idiot, I wrote a piece of code for RPI to upload HEX to PIC, and it works like it should, so at least I know how it works.

Can somebody help me with TeraTerm/RealTerm?

Best regards,
Milentije

EDIT: Yes, I read all other threads I could find regarding this problem, but I couldn't find the solution.
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 6:45 am     Reply with quote

I remember ages ago, finding that in TeraTerm, I had to enable XON/XOFF
in the windows port setup, before it'd work. So, control panel, hardware,
device manager. Ports, select the com port, port settings, and enable
XON/XOFF here. Then enable it in TeraTerm as well. For some reason it
didn't seem to be able to enable it if it was off in the port setup....
Milentije89



Joined: 07 Apr 2017
Posts: 31

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 7:02 am     Reply with quote

Hi Ttelmah,

thank you for your answer.

Srceen shot - https://imgur.com/7XcjF53

Tried that, doesn't work.

EDIT:
Also tried changing buffer size for COM port, nothing...

SIOW works with XON/XOFF disabled.

TeraTerm doesn't work with or without XON/XOFF.

EDIT 2:
Just to mention, everything else works fine in TeraTerm, except HEX upload...
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 7:38 am     Reply with quote

SIOW always accepts XON/XOFF. It is _required_ for the bootload.
It is the only thing that can stop the transmission while the programming
actually takes place. It handles this internally.
Now, I'd have expected possibly there to be a single signal on the RX
line, and then it to go wrong. The bootloader sends XOFF, when it needs
the transmission to stop. It is this and then the XON for each packet, that
you are seeing on the RX line with SIOW. If the transmitting program doesn't
stop when this is sent, then everything from this point will fail as far as the
bootloader is concerned....
What 'protocol' are you using to send the file in TeraTerm?. You do
understand, it has to be sent as an ASCII file, not a binary file?. The
binary mode turns off XON/XOFF, since it allows all bytes to be sent.
You must not tick the binary option in the send file setting.
Milentije89



Joined: 07 Apr 2017
Posts: 31

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 7:53 am     Reply with quote

Ttelmah wrote:
SIOW always accepts XON/XOFF. It is _required_ for the bootload.
It is the only thing that can stop the transmission while the programming
actually takes place. It handles this internally.
Now, I'd have expected possibly there to be a single signal on the RX
line, and then it to go wrong. The bootloader sends XOFF, when it needs
the transmission to stop. It is this and then the XON for each packet, that
you are seeing on the RX line with SIOW. If the transmitting program doesn't
stop when this is sent, then everything from this point will fail as far as the
bootloader is concerned....


I understand this. I am just mentioning that some settings makes no change for SIOW or TeraTerm. Whatever I set there, SIOW works, TeraTerm doesn't.

That is why I think the problem is in flow control, just don't know which setting I am missing in TeraTerm.

Ttelmah wrote:
What 'protocol' are you using to send the file in TeraTerm?. You do
understand, it has to be sent as an ASCII file, not a binary file?. The
binary mode turns off XON/XOFF, since it allows all bytes to be sent.
You must not tick the binary option in the send file setting.


Option "Binary" is not selected, so I presume it is sent as ASCII.

This is a second day that I am loosing because of this problem. I have no idea what to check next.

Clearly, I am missing something in front of my nose, but I can't see what.
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 8:11 am     Reply with quote

One thought.
How is newline setup?.
Teraterm has options to automatically send LF+CR etc.. If one of these
is selected it could be converting the sent linefeed, which would then
make it incompatible with the bootloader.
Milentije89



Joined: 07 Apr 2017
Posts: 31

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 8:23 am     Reply with quote

Tried all 12 possible combinations. Still doesn't work.
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 9:18 am     Reply with quote

Did that include all options turned off?.
Milentije89



Joined: 07 Apr 2017
Posts: 31

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 9:39 am     Reply with quote

No, I don't see that option.
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 9:49 am     Reply with quote

You should need Newline (receive) set to CR, and Newline (transmit)
set the same. The old TeraTerm you had tick boxes, and you could
just leave them all off.
Milentije89



Joined: 07 Apr 2017
Posts: 31

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 9:56 am     Reply with quote

Already tried CR on receive and transmit in TeraTerm, nothing.

YAT (Yet another terminal) has option to turn this off, doesn't work.


I am googling about TeraTerm XON XOFF control and it seams that there is a problem with it.
But, I cant believe that TeraTerm, RealTerm and YAT have the same problem. At least one of them should work, but they don't.

Insane!

EDIT:

XON/XOFF is received from MCU, but it is not interpreted as XON/XOFF.
Same story in TeraTerm, RealTerm and YAT.
In device manager port is set to use XON/XOFF, in all three named apps it is set to be XON/XOFF controlled, but it doesn't work.

THE HELL!!!
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 11:20 am     Reply with quote

Comment.
Forget about the terminal program.
Just setup the windows port settings as required, and simply copy the
hex file to the serial port.
So something like:

copy yourfile.hex \\.\COM06

Using whatever the serial port number actually is.

It should just use the Windows flow control and send the file to the
port.

If this doesn't work, then it says that the driver for your serial port is
not correctly handling the flow control. SIOW, may well be doing it itself,
in the software, while the other programs are probably depending on
the Windows driver doing it....
Milentije89



Joined: 07 Apr 2017
Posts: 31

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 11:31 am     Reply with quote

Yes, SIOW handles it on its own.

I just tried to transfer the file to COM port in command prompt. I got the same behavior. So, MCP2200 drivers are the source of the problem. Or it might be OS.

It would be nice if somebody else, who has some other UART-USB converter, try the same thing. Just to check if it is drivers or OS related. As it seams that problems are present on the Linux as well.

I used:
PIC18F45K22
Serial bootloader from CCS C
CCS C 5.075

MCP2200
Windows 7 64 bit

EDIT:
I can't wait, I just found EasyPIC PRO V7 board on the shelf. It has FTDI, will try it tonight.
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 11:43 am     Reply with quote

What happens is the the serial driver accepts the XOFF, and sends a
CDC_SER_STATE message to the application telling it that this has been
accepted. However there is a bug in usbser that means this will not
automatically be passed, but instead has to be polled for. It looks as if SIOW
has correctly implemented the fix for this, but the other programs are not...

Apparently the FTDI and Prolific chipsets fix this issue. Most others do
not... Sad
Milentije89



Joined: 07 Apr 2017
Posts: 31

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 1:07 pm     Reply with quote

Just tried an example on EasyPIC PRO V7 which has FTDI chip.

Same story. SIOW works, TeraTerm doesn't.
Tried copy from CMD, doesn't work.

Used:
PIC18F87K22
Serial bootloader from CCS C
CCS C 5.075

FT232RL
Windows 7 64 bit

Tried on desktop and laptop, just in case I messed up something about drivers or setting on one of them.

So, we can conclude that problem is not in the drivers but in the OS?

If it is, it is really strange that it exists for such a long time (I can find same problems dating 10+ years in the past), both on Win and Linux, and nobody did anything about it.
Hmmmm, strange.

EDIT:

One fresh example where we can see difference in drivers.
https://www.avrfreaks.net/forum/flow-control-ch340g
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group