Go Down

Topic: Changing serial ports in .h files (Read 231 times) previous topic - next topic

Arduino_Steve

Jun 18, 2019, 09:40 am Last Edit: Jun 18, 2019, 09:42 am by Arduino_Steve
Hello

I have a Nextion screen that needs to use the serial ports on my Pro Mini.
I currently have some DMX code using the serial port, so I need to move one of them.

I seem to remember that the Nextion screen does not like using software serial ports, so it makes sense to move the DMX if possible....    here is where I fail.

I don't exactly understand what I need to change in the DMXserial.h file to allow me to specify the Software serial port pins.

On that note... I assume I can assign any pins on the Pro Mini to be software serial?

Any guidance would be appreciated


PaulS

Quote
I don't exactly understand what I need to change in the DMXserial.h file to allow me to specify the Software serial port pins.
I suggest that you start with reading line 1 of the file you attached.
The art of getting good answers lies in asking good questions.

septillion

The DMX heavily relies on the HardwareSerial (because DMX relies on timing) so I doubt that's the smart move.

Nexion just uses some simple commands so I don't see why that would not work.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Arduino_Steve

Well to be fair, most of these serial files declare they are using the serial port.  Doesn't mean they can't be moved  (... whether they work after that is another issue).

The (very good) Nextion screen tutorial I was watching on Youtube stated that after experimenting, he could not get reliable results using software serial. 

OK.  So both need the default serial port. 
Looks like I either bin the Pro Mini, or jump over to a different platform (don't have space for a Mega)

Thought of a Teensy as it has more serial ports, but the code/library won't compile at all on that.


PaulS

Quote
don't have space for a Mega
There are Mega clones that are the same size as the Uno.
The art of getting good answers lies in asking good questions.

septillion

Like I said, the Nexion doesn't really do much special with Serial so I would start by trying to use SoftSerial for that before jumping to conclusions. There are a lot of people writing tutorials full of crap. ::)
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Riva

I seem to remember that the Nextion screen does not like using software serial ports, so it makes sense to move the DMX if possible....    here is where I fail.
Assuming your Nextion display is set to the default 9600 baud then have you tried it with software serial?

You will have zero chance of getting DMX to run on software serial as it needs to be at 250000 baud and software serial can maybe manage 38400 baud.
Don't PM me for help as I will ignore it.

Arduino_Steve

I have not managed to get the Nextion to use Software serial.   
Read a few links regarding getting that to work....

Changed the Nextion config file (NexConfig.h) - attached:

//#define nexSerial Serial2

#include <SoftwareSerial.h>
extern SoftwareSerial HMISerial;
#define nexSerial HMISerial

Then declare in my code:

#include "Nextion.h"
SoftwareSerial HMISerial(13,12);

But it complies with an error and I can't shift it....

HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':

(.text+0x0): multiple definition of `__vector_18'

C:\Users\STEVEC~1\AppData\Local\Temp\arduino_build_118855\libraries\DMXSerial-master\DMXSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here

HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':

(.text+0x0): multiple definition of `__vector_19'

C:\Users\STEVEC~1\AppData\Local\Temp\arduino_build_118855\libraries\DMXSerial-master\DMXSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status


Its basically clashing with the DMX config file and I cannot see why

septillion

Disable dbSerial as told in the readme ;)
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Arduino_Steve

I have disabled dbSerial.   Same issue.

Google turns up that this 'Vector 18' issue is a problem that doesn't appear to have been solved

PaulS

I have disabled dbSerial.   Same issue.

Google turns up that this 'Vector 18' issue is a problem that doesn't appear to have been solved
The vector 18 issue is happening because two libraries are trying to use the same interrupt handler. HardwareSerial uses the ones at __vector_18 and __vector_19. So does some other library you are using.

The solution is quite simple. Don't do that.
The art of getting good answers lies in asking good questions.

Arduino_Steve

The solution is quite simple. Don't do that.
Useful.  I know that I 'don't want to do that'....  but HOW do I not do that. 

There is nothing I can see with my hobby level eye in the config files that will change anything.
I can only assume it is a deeper issue.

I think its time to abandon the Pro Mini for this project and move to something else.
What that will be, I am not sure


PaulS

You have some code that you haven't shared. There are at least three libraries involved, but we've only seen one file from one library. Can you see why we can't help you?
The art of getting good answers lies in asking good questions.

septillion

#13
Jun 18, 2019, 04:27 pm Last Edit: Jun 18, 2019, 04:27 pm by septillion
Yeah, HardwareSerial Serial uses the same vectors but after changing the Nextion config I don't see why Serial should be called.... Aka, why and where it's done after removing the references to serial from Nextion-library.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Arduino_Steve

The conflict is between the DMX and the Nextion libraries.  Comment either one out, and the code compiles.
Only other libraries in use are wire.h and EEprom.

I know you can't use debug serial anywhere else otherwise it causes issues (many people with that issue).

Thank you for the suggestions.  I will investigate later on.  Tired of looking at it currently

Go Up