Serial Communication Problems

General discussion of using Roboclaw motor controllers
MaskOfSanity
Posts: 13
Joined: Fri Sep 15, 2017 7:51 am
Re: Serial Communication Problems

Post by MaskOfSanity »

Hi nice to hear.

I hope it doesn't take too long. (eg. 2-3 Months) :?

If you are interessted, i have an idea how you can realize your "Write" Scenario:
  • 1. Introduce an Ringbuffer/ circular buffer for TX messages with 1.2 times the Length of the longest telegramm data
    2. Use a ISR for writing the data to the serial periphery
An Example:

Like this a ringbufferclass could look like:

Code: Select all

// This is a pseudocode example (as class for better unterstanding)

// HEADER
class Ringbuffer 
{
	public:
		Ringbuffer();
		
		void Add(uchar data);
		bool hasData();
		uchar ReadNext();
}

Ringbuffer TxBuffer;

This is a pseudocode example of the realisation for the Interrupt Service Routine.
It has to be adapted to your Hardware / MCU.

Code: Select all

ISR UARTTxMethod (void)
{
	if (USARTTxReadyToWrite == true)	// Hardwareflag depends on the MCU, Indicates,
								// that TxReg can be filled and transmittion is done
	{
		if (TxBuffer.hasData() == true)
		{
			if (UseDirPin == true) { DIR = 1; }	// optional
			uchar data = TxBuffer.ReadNext();
			USART.Send(data);				// TxReg for USART
		}
		else
		{
			// Transmittion finished no more Data are available in Ringbuffer
			USART.DisableTx();
			if (UseDirPin == true) { DIR = 0; }
		}
	}
}

This is a Example how the Temprature value could be wrote back.

Code: Select all

 // User Method
 
 void sendTemprature()
 {
 	uint16_t checksum;
 	uchar highByte, lowByte;
 	
 	lowByte =  Temprature & 0xFF;
 	highByte = (Temprature >> 8) & 0xFF;
 	
 	checksum = calcCRC(checksum, mcuadress);
 	checksum = calcCRC(checksum, 82);
 	checksum = calcCRC(checksum, highByte);
 	checksum = calcCRC(checksum, lowByte);
 	
 	TxBuffer.Add(highByte);
 	TxBuffer.Add(lowByte);
 	
 	lowByte = checksum & 0xFF;
 	highByte = (checksum >> 8) & 0xFF;
 	
 	TxBuffer.Add(highByte);
 	TxBuffer.Add(lowByte);
 	
	WriteUSART();
 }
 
 // This Method starts the USART.Transmitter and should leed to the first ISR call:
 void WriteUSART()
 {
 	if (UseDirPin == true) { DIR = 1; }
  	USART.EnableTx();
 }
 
 

I hope this example helps you to find a solution.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Serial Communication Problems

Post by Basicmicro Support »

We do not use interrupts(or DMA) for transmitting data on the Roboclaw. Only the receiver buffer uses an interrupt/DMA transfer. This is because transmitting data from the Roboclaw is a low priority action.

What you describe as far as how the dir pin is set/cleared is what we effectively do now. Which is why I have to look into it further to see what is causing your new problem. I cant say how long it will take but I dont expect it to be months.
MaskOfSanity
Posts: 13
Joined: Fri Sep 15, 2017 7:51 am
Re: Serial Communication Problems

Post by MaskOfSanity »

Hi,

ok then its much easier, when you don't use interrupts or DMA.

Code: Select all

void WriteUSART()
 {
    if (UseDirPin == true) { DIR = 1; }
    USART.EnableTx();
    
    while (TxBuffer.hasData() == true)
    {
    	if (USARTTxReadyToWrite == true)
    	{
    		uchar data = TxBuffer.ReadNext();
         	USART.Send(data);            // TxReg for USART
    	}
    }
    
    USART.DisableTx(); 
    if (UseDirPin == true) { DIR = 0; }
 }
Sorry for prattle away...
Now i let you do your work.

bye
MaskOfSanity
Posts: 13
Joined: Fri Sep 15, 2017 7:51 am
Re: Serial Communication Problems

Post by MaskOfSanity »

Hello it's me :D

One Month Status check:

Do you know if the Dir-Pin-Problem is still fixed?
Is there a Firmware release in the next few days?

I still believe in you, that you wouldn't need 3 Months.

Bye
MaskOfSanity
Posts: 13
Joined: Fri Sep 15, 2017 7:51 am
Re: Serial Communication Problems

Post by MaskOfSanity »

Hello,

two to three Months status check?
How does it move forward?

Any Firmwareupdates still there?

Come on guys....
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Serial Communication Problems

Post by Basicmicro Support »

Please send an email to support. We should be able to send you a pre-release of the next firmware. We have had a number of other changes that need to be fully tested on all models before we can make a general release. I dont expect to be able to make the new general release available for at least another month.

Note, even simple changes to the firmware still means the firmware has to go through full testing and there have been alot more than just one change made to the new firmware for this next release.
MaskOfSanity
Posts: 13
Joined: Fri Sep 15, 2017 7:51 am
Re: Serial Communication Problems

Post by MaskOfSanity »

what is the email form support?

general@ionmc.com

or

sales@ionmc.com

???
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Serial Communication Problems

Post by Basicmicro Support »

MaskOfSanity
Posts: 13
Joined: Fri Sep 15, 2017 7:51 am
Re: Serial Communication Problems

Post by MaskOfSanity »

Hi there short status update for all of you,

the problems are still there
i didn't hear anything from the support since two months.
Maybe they are on vacations....

to be continued.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Serial Communication Problems

Post by Basicmicro Support »

Did you download and install the latest version(we released it a couple weeks ago? This release had a minor change to the code for the RS485 dir pin output but we dont know if it will fix your particular problem.

Post Reply