Menu

GetString using software serial similar to HSergetstring

wn
2020-04-04
2020-05-09
1 2 > >> (Page 1 of 2)
  • wn

    wn - 2020-04-04

    I am testing a new board and had to switch to software serial due to a board error. I would like to have a function similar to Hsergetstring that would work with ser1receive. I am at 115200 baud and do get comms back but having difficulty with ser1receive in terms of capturing the data. I have tried 57600 with the same result. I am working with a ESP-12S wifi chip and an ATMEGA328pb. I have looked at the buffer ring example but I can't apply it as I don't have a USART Interrupt that I know of.

     
    • Anobium

      Anobium - 2020-04-04

      You can try to enable interrupts in the dat. As I remember the .dat for this chip is hand crafted. So, add

      [Interrupts]
      UsartRX1Ready:USART_RX,36,RXCIE0,RXC0
      UsartTX1Ready:USART_UDRE,38,UDRIE0,UDRE0
      UsartTX1Sent:USART_TX,40,TXCIE0,TXC0
      

      Ensure those bits/registers are valid. That should fire up the serial interrupt.


      Re ser1receive. We need Frank Steinberg to help you.

       
  • Frank Steinberg

    Frank Steinberg - 2020-04-04

    Hi!

    I attached a demo for receiving strings with timeout yet without using timers and interrupts. I tested on an Arduino Uno. Maybe you can get it to work on your 328pb.

    Frank

     
  • wn

    wn - 2020-04-04

    Thanks for both replies. I implemented Frank's code and it is working great! I am still having an issue with data received via the esp8266 but that may be a topic for another forum. It echos fine and displays 0,CONNECTED when I connect a TCP Client. However the data comes through as garbage. Thanks again for the help!

     
    • Anobium

      Anobium - 2020-04-09

      Frank is that demo in the build?

       
  • Anobium

    Anobium - 2020-04-11
     
    • Anobium

      Anobium - 2020-05-07

      @Frank. I am having issue with the 12F1501 projects.

      What version of the compiler etc did you use? I am getting Error: Excessive RAM usage! Delete some variables, reduce the size of arrays, or upgrade to a more powerful chip

      I have tried 0.98.06 and .05. Yours is?

       
  • Frank Steinberg

    Frank Steinberg - 2020-05-07

    Mine is 0.98.06

     
  • Anobium

    Anobium - 2020-05-07

    When you have a moment can you send me the ASM from your compiled projects.

    Thanks

     
  • Frank Steinberg

    Frank Steinberg - 2020-05-07

    Attached

     
    • Anobium

      Anobium - 2020-05-08

      Thank you. Still no closer to resolve the error here on test.

      Please send your 12F1501.dat file from the chipdata folder.

      Thank you.

       
  • Frank Steinberg

    Frank Steinberg - 2020-05-08

    Chipdata

     
  • Anobium

    Anobium - 2020-05-08

    There is some wrong somewhere.

    These new files are fail on test here. I have gone back to 0.95 and I cannot make is compile. I get not enough memory error.

    Can you please upload your installation to a cloud location so I can download? I need to resolve as this is concerning. I don't like releasing when we have odd errors like this.

    Cheers

     
    • Anobium

      Anobium - 2020-05-08

      Error here using the Gold build back to 0.95. All the same.

      Do we have a difference in the soft serial .h files? You build will tell us that.

      Compiling C:\Users\admin\Downloads\Ser1ReceiveString-inverted_12f1501.gcb ...
      
      An error has been found:
      
      Error: Excessive RAM usage! Delete some variables, reduce the size of 
      arrays, or upgrade to a more powerful chip
      
      The message has been logged to the file Errors.txt
      
       
  • Frank Steinberg

    Frank Steinberg - 2020-05-08

    Ok, found the cause!

    Do we have a difference in the soft serial .h files? You build will tell us that.

    You are right! I played with the calulation-scripts inside my "softserialch1.h" file. Doing that, I noticed some differences in the calling convention of the "Ser1Print" subs and replaced ...

    Sub Ser1Print (PrintData As String)
    

    with

    Sub Ser1Print (In PrintData As String)
    

    That seem to cause the decrease the RAM-usage in my version. The scandal is, that I forgot about that.

    So all we have to do, is to update the three include files with that two letters.

    Please test and I will make the bugfix and post the fixed files here.

    Frank

     
  • Anobium

    Anobium - 2020-05-08

    Wow. Well done. That resolves the issue!

    Send latest through!

    Thank you!

     
  • Anobium

    Anobium - 2020-05-08

    Wow. Well done. That resolves the issue!

    Send latest through!

    Thank you!

     
  • Frank Steinberg

    Frank Steinberg - 2020-05-08

    Maybe we should have a look at the "stock" SerPrint too (I cloned SerNPrint from) .

    As far as I understand, it may have the same issue. It's called this way (rs232.h):

    sub SerPrint (In Ser_Select, PrintData As String)
    
     
    • Anobium

      Anobium - 2020-05-08

      If you have time. This would be a good idea.

       
  • Frank Steinberg

    Frank Steinberg - 2020-05-08

    Fixed files:

     

    Last edit: Frank Steinberg 2020-05-08
    • Anobium

      Anobium - 2020-05-08

      I will merge and test.

      Thank you.

       
      • Anobium

        Anobium - 2020-05-09

        Merged into the Gold BUILD.

        All resolved. Well done!

         
  • Frank Steinberg

    Frank Steinberg - 2020-05-08

    Done for "rs232.h" the same way - same result.

    The advantages are only noticeable if string-constant printing is done, not for string variable printing. Probably because without "In" the constant has to be copied into a string variable by the compiler (which is also logical because it could be changed).

    "example_softuart_12f1501.gcb" uses 30 instead of 43 bytes RAM. The difference of 13 bytes is the number of bytes of the printed text plus one length byte.

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.