Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
serial <=> cdc at speeds >4800 not working
06-04-2016, 10:21 AM,
#1
serial <=> cdc at speeds >4800 not working
Hi,

I'd like to attach an ESP82866 module to my pinguino. The ESP8266 runs at 115200 baud so I wrote a simple terminal program to talk to the ESP8266 and communicate with it via CDC. It did not work so I connected a pl2303 converter instead using (minicom, screen or a custom python scipt) to debug the problem.

I have this code (using linux and the beta4 ide on a PIC18F4550 at 40Mhz). This seems to work fine at 4800 baud but at 9600 it loses characters and at 115200 it does not work at all.

I have a hard time understanding why the pinguino code can't keep up past 4800 baud?

I tried the new version 12 ide and this code does not compile. (there is a function the cdc and serial libraries have in common and it does not compile ie a bug in the new libraries)

Any ideas?

thanks!
earl

Code:
u8 buffer[128];
int c;

void setup() {
  Serial.begin(4800);
}

void loop() {
  u8 len = CDC.read(buffer);
  if (len > 0) for(c=0;c<len;++c) Serial.write(buffer[c]);
  while (Serial.available()) CDC.write(Serial.read());
}
Reply
06-04-2016, 12:52 PM, (This post was last modified: 06-04-2016, 12:53 PM by regis.)
#2
RE: serial <=> cdc at speeds >4800 not working
Hi,
I see the problem.


In v11 there were some functions (printNumber, printFloat) defined all the same in a lot of libraries (Serial, USB CDC, i2c, SPI, LCD, ...).


In v12 these functions are now in their own C file (printNumber.c, printFloat.c or printFormated.c) and they all use an external defined printChar function.


printChar depends on the communication protocol. There is one for each library (Serial, USB CDC, ...).


You used Serial and CDC at the same time and that's why we now have this conflict.


I don't have a solution right now but I'll think about it.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
11-04-2016, 06:03 PM,
#3
RE: serial <=> cdc at speeds >4800 not working
Fixed. It will be part of the next testing update.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
13-04-2016, 10:11 PM,
#4
RE: serial <=> cdc at speeds >4800 not working
(11-04-2016, 06:03 PM)regis Wrote: Fixed. It will be part of the next testing update.

thanks!!

is the code downloadable anywhere to test before then?

earl
Reply
13-04-2016, 10:57 PM,
#5
RE: serial <=> cdc at speeds >4800 not working
github > pinguinoide > pinguino-libraries > branch v12-dev
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
13-04-2016, 11:42 PM,
#6
RE: serial <=> cdc at speeds >4800 not working
(13-04-2016, 10:57 PM)regis Wrote: github > pinguinoide > pinguino-libraries > branch v12-dev

I am getting the same error with that branch:


2016-04-13 17:05:55.729073
######################################################################
Microchip MPLAB XC8 C Compiler (Free Mode) V1.37
Build date: Mar 10 2016
Part Support Version: 1.37
Copyright © 2016 Microchip Technology Inc.
License type: Node Configuration

Employing 18F4550 errata work-arounds:
* Corrupted fast interrupt shadow registers
(1273) Omniscient Code Generation not available in Free mode (warning)
/opt/microchip/xc8/v1.37/bin/cpp @/tmp/cpp_xcX5VrBQC.cmd
/opt/microchip/xc8/v1.37/bin/cpp @/tmp/cpp_xcXMoB7du.cmd
/opt/microchip/xc8/v1.37/bin/p1 @/tmp/p1_xcXjxxGbd.cmd
/root/.pinguino/v12/source/user.c: loop()
11: u8 len = CDCgets(buffer);
^ (361) function declared implicit int (warning)
/opt/microchip/xc8/v1.37/bin/cgpic18 @/tmp/cgpic18_xcXa7aCK4.cmd
/opt/microchip/xc8/v1.37/bin/cgpic18 @/tmp/cgpic18_xcXvV6yzX.cmd
/opt/pinguino12/v12/p8/include/pinguino/libraries/printFormated.c: 52: (1471) indirect function call via a NULL pointer ignored (warning)
/opt/pinguino12/v12/p8/include/pinguino/libraries/printFormated.c: 407: (1496) arithmetic on pointer to void yields Undefined Behavior (warning)
/opt/pinguino12/v12/p8/include/pinguino/libraries/printFormated.c: 415: (1496) arithmetic on pointer to void yields Undefined Behavior (warning)
/opt/pinguino12/v12/p8/include/pinguino/libraries/printFormated.c: 428: (1496) arithmetic on pointer to void yields Undefined Behavior (warning)
/opt/pinguino12/v12/p8/include/pinguino/libraries/printFormated.c: 435: (1496) arithmetic on pointer to void yields Undefined Behavior (warning)
/opt/pinguino12/v12/p8/include/pinguino/libraries/printFormated.c: 442: (1496) arithmetic on pointer to void yields Undefined Behavior (warning)
/opt/pinguino12/v12/p8/include/pinguino/libraries/printFormated.c: 449: (1496) arithmetic on pointer to void yields Undefined Behavior (warning)
/opt/pinguino12/v12/p8/include/pinguino/libraries/printFormated.c: 456: (1496) arithmetic on pointer to void yields Undefined Behavior (warning)
/opt/pinguino12/v12/p8/include/pinguino/libraries/printFormated.c: 465: (1496) arithmetic on pointer to void yields Undefined Behavior (warning)
/opt/pinguino12/v12/p8/include/pinguino/libraries/printFormated.c: 474: (1496) arithmetic on pointer to void yields Undefined Behavior (warning)
/opt/pinguino12/v12/p8/include/pinguino/core/__cdc.c: 291: (1496) arithmetic on pointer to void yields Undefined Behavior (warning)
/root/.pinguino/v12/source/user.c: 11: (1464) number of arguments passed to function "_CDCgets" does not match function's prototype (warning)
/opt/microchip/xc8/v1.37/bin/aspic18 @/tmp/aspic18_xcXWQg6OU.cmd
/opt/microchip/xc8/v1.37/bin/aspic18 @/tmp/aspic18_xcXsWvXmQ.cmd
/opt/microchip/xc8/v1.37/bin/hlink @/tmp/hlink_xcXoo8S9N.cmd
0: (499) undefined symbol:
_CDCgets(/root/.pinguino/v12/source/main.obj)
(908) exit status = 1
rm /root/.pinguino/v12/source/main.obj
rm /tmp/xcXkqgjg3
rm /tmp/xcXxYG5qU
rm /tmp/xcXQwoSBL
rm /tmp/cpp_xcX5VrBQC.cmd
rm /tmp/cpp_xcXMoB7du.cmd
rm /tmp/p1_xcXjxxGbd.cmd
rm /tmp/cgpic18_xcXa7aCK4.cmd
rm /tmp/cgpic18_xcXvV6yzX.cmd
rm /tmp/aspic18_xcXWQg6OU.cmd
rm /tmp/xcXNtuZAS.as
rm /tmp/xcXNtuZAS.obj
rm /tmp/aspic18_xcXsWvXmQ.cmd
rm /tmp/hlink_xcXoo8S9N.cmd
(908) exit status = 1


or with SDCC




2016-04-13 17:07:51.865378
######################################################################
/dvpt/pinguino/git-copy/pinguino-compilers/sources/sdcc/src/pic16/main.c:701 setting interrupt vector addresses 0xc00
/opt/pinguino12/v12/p8/include/pinguino/core/usb/picUSB.c:409: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
/opt/pinguino12/v12/p8/include/pinguino/libraries/printFormated.c:172: warning 85: in function pprinti unreferenced function argument : 'separator'
/opt/pinguino12/v12/p8/include/pinguino/libraries/printFormated.c:333: warning 85: in function pprintfl unreferenced function argument : 'separator'
/opt/pinguino12/v12/p8/include/pinguino/libraries/printFormated.c:416: warning 196: pointer target lost const qualifier
/opt/pinguino12/v12/p8/include/pinguino/core/__cdc.c:66: warning 158: overflow in implicit constant conversion
/root/.pinguino/v12/source/user.c:14: warning 112: function 'CDCgets' implicit declaration
/root/.pinguino/v12/source/user.c:14: error 101: too many parameters
Processor: 18f4550
sdcc: Calling preprocessor...
sdcc: sdcpp -nostdinc -Wall -DPINGUINO4550 -Dboot4 -DBOARD=\"PINGUINO4550\" -DPROC=\"18f4550\" -DBOOT_VER=4 -I/opt/pinguino12/v12/p8/include/pinguino/core -I/opt/pinguino12/v12/p8/include/pinguino/libraries -I/opt/pinguino12 -D__18f4550 -D__SDCC_PIC18F4550 -D__STACK_MODEL_SMALL -obj-ext=.o -D__SDCC_USE_NON_FREE -D__SDCC_ALL_CALLEE_SAVES -D__SDCC=3_5_5 -D__SDCC_VERSION_MAJOR=3 -D__SDCC_VERSION_MINOR=5 -D__SDCC_VERSION_PATCH=5 -DSDCC=355 -D__SDCC_REVISION=9410 -D__SDCC_pic16 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem /opt/pinguino12/p8/bin/../share/sdcc/include/pic16 -isystem /dvpt/pinguino/git-copy/pinguino-compilers/linux64/p8/share/sdcc/include/pic16 -isystem /opt/pinguino12/p8/bin/../share/sdcc/include -isystem /dvpt/pinguino/git-copy/pinguino-compilers/linux64/p8/share/sdcc/include -isystem /opt/pinguino12/p8/bin/../share/sdcc/non-free/include/pic16 -isystem /dvpt/pinguino/git-copy/pinguino-compilers/linux64/p8/share/sdcc/non-free/include/pic16 -isystem /opt/pinguino12/p8/bin/../share/sdcc/non-free/include -isystem /dvpt/pinguino/git-copy/pinguino-compilers/linux64/p8/share/sdcc/non-free/include /root/.pinguino/v12/source/main.c
sdcc: Generating code....
Reply
25-05-2016, 03:17 PM,
#7
RE: serial <=> cdc at speeds >4800 not working
I got it working (compiled fine) and seems to work great at 115200 baud using the XC8 compiler.

What i did was un-comment the CDCgets function in ../v12/p8/include/pinguino/core/usb/usb_cdc.c

I am now able to communicate CDC<=>Serial and run my new NL6621-Y1 wireless module with the pinguino! Hurray!


Not sure why those functions in usb_cdc.c are commented out?
Reply
25-05-2016, 03:24 PM,
#8
RE: serial <=> cdc at speeds >4800 not working
well.. after testing for a while .. it seems that it partially works.. still losing characters at 115200 baud
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)