|
Post by lglasmacher on Oct 11, 2018 20:55:08 GMT
Hello,
For communication to a sensor over RS485 I need to configure two serial ports to: 8 Databits, 1 Startbit, 1 Stopbit and even parity. The simple arduino style like: Serial0.begin(115200,SERIAL_8E1) compiles but makes no difference. On the oscilloscope it looks like the arduino on default (8N1).
How do I conifgure the serial ports?
Thank you very much Lukas
|
|
|
Post by Admin on Oct 12, 2018 12:21:39 GMT
The ShieldBuddy SerialX.begin() does not current support parity but we will add it in the next release. In the meantime, you could try this to enable even parity:
Ifx_ASCLIN *UARTBASE;
Serial0.begin(115200);
/* This is ASC1, Serial0.begin */ UARTBASE = &MODULE_ASCLIN1; UARTBASE->FRAMECON.B.PEN = 1u; UARTBASE->FRAMECON.B.ODD = 0u;
Serial1.begin(115200);
/* This is ASC2, Serial1.begin */ UARTBASE = &MODULE_ASCLIN2; UARTBASE->FRAMECON.B.PEN = 1u; UARTBASE->FRAMECON.B.ODD = 0u;
|
|
|
Post by lglasmacher on Oct 12, 2018 16:50:01 GMT
Hello Admin,
Thanks for the advice but first trial didn't worked. Again it compiled but no change on the osciloscope.
Any other idea?
Bye Lukas
|
|
|
Post by Admin on Oct 15, 2018 15:24:55 GMT
We'll check this again!
|
|
|
Post by lglasmacher on Oct 15, 2018 18:37:27 GMT
Thanks for checking again.
I tried to directly write in the Framecon Register but with every Serial print command it seems to reset to the value set by the serial begin.
Code:
unsigned int *p = (unsigned int*) 0xF0000618; // unsigned int wert1 ,wert2, wert3, wert4, neuerwert;
void setup() {
neuerwert = 1073807872; // Dezimal Wert zum meiner Meinung nach gewünschten Framecon mit 30 16 und 9 High in Anlehnung an 18-71 TC27x Anleitung wert1 = *p; SerialASC.begin(9600);//Zum PC
SerialASC.print("wert1:"); SerialASC.println(wert1, BIN);
Serial.begin(9600);
wert2 = *p; SerialASC.print("wert2:"); SerialASC.println(wert2, BIN);
*p = neuerwert; wert3 = *p; SerialASC.print("wert3:"); SerialASC.println(wert3, BIN);
}
void loop() {
Serial.print("UUU"); wert4 = *p; SerialASC.print("wert4:"); SerialASC.println(wert4, BIN); delay (1000);
}
Serial Montior:
wert1:0 wert2:10000001000000000 wert3:1000000000000010000001000000000 wert4:10000001000000000 wert4:10000001000000000 wert4:10000001000000000 wert4:10000001000000000 wert4:10000001000000000 wert4:10000001000000000 wert4:10000001000000000 ...
Any chance to set the register and keep the change?
Thanks and Bye
|
|
|
Post by Admin on Oct 17, 2018 12:40:07 GMT
|
|
|
Post by lglasmacher on Dec 11, 2019 23:14:20 GMT
Hello,
Thanks for your help in 2018 and with the Versions v.1.63 and following it worked fine to configure the serial ports on the shieldbuddy. But a couple of weeks ago I installed the newest Version and now have Version v1.88 and it seems that again it is not possible to configure the serial ports with for example Serial0.begin(57600, SERIAL_8E1);. The sensor is not responding right and on the osiloscop it doen't change with changing configs and it looks different then the Arduino default of 8n1.
Thanks for checking or ideas what I could try. Bye Lukas
|
|
|
Post by Admin on Dec 14, 2019 8:51:52 GMT
|
|
|
Post by lglasmacher on Dec 16, 2019 18:10:51 GMT
Hello, Thanks for your fast response. But I can't unzip the new ShieldBuddy Add-in. I get a Failure 0x80004005 and can't extract. On Windows 7 and 10. Bye Lukas Attachments:
|
|
|
Post by Admin on Dec 16, 2019 19:19:08 GMT
There was an error in the file. Please download it again.
|
|
|
Post by lglasmacher on Dec 16, 2019 21:17:24 GMT
Still the same error? Attachments:
|
|
|
Post by mjb on Dec 16, 2019 22:28:48 GMT
I have just tried it and is works fine. Is you antivirus tool causing problems? We have seen this kind of problem.
|
|
|
Post by lglasmacher on Dec 17, 2019 15:51:11 GMT
I could extract it with a special Zip program (I used 7 Zip) it seems that the Win7 extraction Software is causing the 0x80004005 failure and parity works again.
Thanks for your help!
|
|