USB serial PIC18F2455 compile warning

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

radist73
Posts: 36
Joined: Mon Dec 22, 2014 10:04 pm
Location: TALLINN
Has thanked: 5 times
Been thanked: 2 times
Contact:

USB serial PIC18F2455 compile warning

Postby radist73 » Wed Dec 07, 2016 3:15 pm

Hi,
Some questions about USBserial ...
1. Compiler give warning message:

Employing 18F2455 errata work-arounds:
* Corrupted fast interrupt shadow registers
. . .

ENC28J60_Example3.c: FCD_056e1_USB_Serial1__ReadByte()
902: return (FCR_RETVAL);
^ (345) unreachable code (warning)

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2. USBserial cant initialize without connection to PC. Main loop will run only after USB is connected to PC. It is OK?
I think, USB serial is not a first priority device... For example, if USB serial is used only for debugging or device configuration, device need to be started without usb connection, but usb need to be ready for hot connection of PC. What solution may be good for this?
3. attached example contain a 1sec flasher made by TMR0 interrupt, and once per second usb serial send "connection check" text to pc. It works ok. When webserver receive GET command, usbserial must send to terminal message "get received". In real hardware after message "get received" usb will crash. Main loop works, led blinks, web page works, but 1sec test messages and GET messages not working.
Usb start working again only after usb cable disconnecting and terminal program restarting. Is it any bug or my wrong code?
Thanks!
Attachments
ENC28J60_Example3.fcfx
(41.99 KiB) Downloaded 67 times

User avatar
Benj
Matrix Staff
Posts: 14676
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4660 times
Been thanked: 4284 times
Contact:

Re: USB serial PIC18F2455 compile warning

Postby Benj » Wed Dec 07, 2016 4:14 pm

Hello,

1) The errata workaround warnings are just saying there are known issues on the chip and that the compiler knows how to get around them. Nothing to worry about. The unreachable code one is interesting and I will investigate.

2) The USB component has a property (Enumeration Timout) which allows it to either wait forever (default) or timeout after a number of seconds to allow your program to carry on without USB comms if not plugged in.

3) I'll have a look for you.

radist73
Posts: 36
Joined: Mon Dec 22, 2014 10:04 pm
Location: TALLINN
Has thanked: 5 times
Been thanked: 2 times
Contact:

Re: USB serial PIC18F2455 compile warning

Postby radist73 » Wed Dec 07, 2016 4:38 pm

No any result with Enumeration timeout turned to YES and time 0,2,5 or 10 seconds. :( Program will start only after connecting usb to pc once. After disconnecting program stay to run.