Jump to content
Sign in to follow this  
jcR

Uarts on Stellaris Launchpad

Recommended Posts

Hello to all

I worked hard on serials communications for Stellaris Launchpad with Energia.
I can now provide all the files (MODIFS.zip) for the correct operation of the card with the ports 0,1,2,3,5,6,7.
And a test file with the corresponding wiring on the Launchpad.
Unfortunately there is a major problem with the operation of ports in serial reception:
You can not send a frame on a serial port in reception if you do not treat the reception of these frames. This causes software crash for the cards .
Otherwise if the frames are received in time all UARTs work perfectly.

Remark: it's not necessary to remove resistor R15 to work with Serial2
idem for Serial6 (USB) . you can work without modifs!
JCR

 

I have updated the files with corrected HardwareSerial.h 

MODIFSupdated.zip

Share this post


Link to post
Share on other sites

What do you mean with "You can not send a frame on a serial port in reception if you do not treat the reception of these frames"? Does the software in the attached library take care of this problem?

Share this post


Link to post
Share on other sites

No , if you not read the recept buffer with "Serialx.read" command the system crash !!

not necessarily the first time, but if you  again re-sent, then the system crash.

You can try this with my test program!

see MODIFS.zip

JCR

Share this post


Link to post
Share on other sites

@JCR

 

You must remove from MODIFS.zip -> HardwareSerial.cpp :

 

void HardwareSerial::selectModule(unsigned long module)
{
...
}

because You comment in class inside  HardwareSerial.h

and compilation break with error...

Share this post


Link to post
Share on other sites

I am sorry

My comment //void selectModule(unsigned long); must be removed

 

I verified my files several times, and unfortunately it is a mistake that has escaped me.

 

Thanks for the remarks.

 

JCR

Share this post


Link to post
Share on other sites

As far as I know, that suggests that the HardwareUARTs use a back to back buffer for Tx and Rx that could explain that reason (It does not 'crash' it simply 'waits' for a buffer space to place Tx bytes on it, and since it's full of Rx bytes that are not going anywhere, it gets deadlocked).

 

That being said, It makes me wonder regarding real-world application that uses these uarts, It makes implementing software congestion control/limit obligatory when transferring frames that might be larger then the buffer.

 

JCR, Thanks, it does seem to work (and get stuck as i expect it to, when loopbacking).

Share this post


Link to post
Share on other sites

I am sorry

My comment //void selectModule(unsigned long); must be removed

 

I verified my files several times, and unfortunately it is a mistake that has escaped me.

 

Thanks for the remarks.

 

JCR

 

Please, can you confirm the file MODIFS.zip is updated?

Share this post


Link to post
Share on other sites

As far as I know, that suggests that the HardwareUARTs use a back to back buffer for Tx and Rx that could explain that reason (It does not 'crash' it simply 'waits' for a buffer space to place Tx bytes on it, and since it's full of Rx bytes that are not going anywhere, it gets deadlocked).

 

That being said, It makes me wonder regarding real-world application that uses these uarts, It makes implementing software congestion control/limit obligatory when transferring frames that might be larger then the buffer.

 

JCR, Thanks, it does seem to work (and get stuck as i expect it to, when loopbacking).

There is an error in the file SerialHardware.cpp line 386:

 

 

The file SerialHardware.cpp must be modified as described here:

// present code start at line 386

while(RX_BUFFER_FULL);

rxBuffer[rxWriteIndex] =

(unsigned char)(lChar & 0xFF);

rxWriteIndex = ((rxWriteIndex) + 1) % SERIAL_BUFFER_SIZE;

 

//new code

while(RX_BUFFER_FULL){

rxBuffer[rxWriteIndex] =

(unsigned char)(lChar & 0xFF);

rxWriteIndex = ((rxWriteIndex) + 1) % SERIAL_BUFFER_SIZE;}

 

this correct the overflow error in writing the reception ring buffer !!!!!!

 

i have created a pull request for this.

 

jcR

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...