Sony's Developer World forum

    • Home
    • Forum guidelines

    Upcoming maintenance 

     

    Dear Customers and Partners.

    This website will be undergoing scheduled maintenance on June 14, 2023. Please be aware there may be disruption to the developer portal website and associated services during the scheduled maintenance period.

    This upgrade is essential to ensure the continued performance, reliability, and security of Developer World.

    We apologize for any inconvenience.

     

     

    UART use with spresense SDK

    Spresense
    3
    8
    1611
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      Thaïs last edited by Thaïs

      Hi,
      We are trying to use a RN2483 module with the sony spresense (using the SDK) to send LoRa messages.
      We have troubles using the UART and we would like to know how to use it to send something?
      Is there any library/example that would make it easier for us to use the UART?

      Thank you for your help!

      C 1 Reply Last reply Reply Quote
      • C
        CamilaSouza DeveloperWorld @Thaïs last edited by CamilaSouza

        Hey, @Thaïs

        I'll link some material from our documentation that may help.

        https://developer.sony.com/develop/spresense/docs/hw_docs_en.html#_how_to_use_uart
        Attention to this part:

        "The Spresense main board and extension board have UART terminals.
        
        It is not possible to use the UART on both the main board and the extension board at the same time.
        The extension board is configured to have the UART enabled when it is shipped. To use the UART pins on the main board when attached to the extension board, a 2.54mm pitch jumper have to be connected to pin 1 and 2 on JP10 of the extension board to disable the extension board UART. No jumper is supplied with the Spresense boards so this has to be purchased separately.
        When the extension board UART is activated, the UART pins (D00, D01, D27 and D28) of the main board cannot be used as GPIO."
        

        This example is for circuipython, but might help with the idea and wiring.
        https://developer.sony.com/develop/spresense/docs/circuitpython_tutorials_en.html#_adding_an_ultrasonic_uart_device_to_spresense

        This one uses LoRa, but it is made for Arduino. But maybe it might be able to help too.
        https://developer.sony.com/develop/spresense/docs/overview_tutorials_en.html#_how_to_equip_spresense_with_lora_connectivity

        I hope this brings some light on the issue.

        1 Reply Last reply Reply Quote
        • T
          Thaïs last edited by

          Thanks for your quick answer,
          Actually, we already checked that and know what we want to do with the UART.
          What we really need are the elementary functions to send and receive (TX/RX) using the UART and also the tools to configuration the interface, baudrate, ...

          Indeed, we have no example in the SDK on how to select the desired UART.

          C 1 Reply Last reply Reply Quote
          • R
            RomainPC 0 1 1 1 1 1 1 last edited by RomainPC 0 1 1 1 1 1 1

            Hey,

            I am able to read/write on UART2.
            I used the unix like read/write commands with file descriptor.
            As in the serialblaster example :

            #define UART2_PATH "/dev/ttyS2"
            ...
            int fd = open(UART2_PATH, O_RDWR);
            write(fd, "test\n", 5);
            

            Be careful to correctly plug the main board on the extension board to use JP13 pins.

            About the UART configuration it is difficult to dynamicly change settings, however I can change UART2 baudrate in the SDK config file : CONFIG_UART2_BAUD=57600

            C 1 Reply Last reply Reply Quote
            • C
              CamilaSouza DeveloperWorld @Thaïs last edited by CamilaSouza

              @Thaïs

              If you know how to use the UART in Arduino or CircuitPython, you can take a look at how they use the SDK.

              Arduino:
              https://github.com/sonydevworld/spresense-arduino-compatible/blob/master/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/cores/spresense/HardwareSerial.cpp

              CircuitPython:
              https://github.com/adafruit/circuitpython/blob/main/ports/cxd56/common-hal/busio/UART.c

              1 Reply Last reply Reply Quote
              • C
                CamilaSouza DeveloperWorld @RomainPC 0 1 1 1 1 1 1 last edited by

                Thank you for the input, @RomainPC-0-1-1-1-1-1-1 !

                1 Reply Last reply Reply Quote
                • T
                  Thaïs last edited by

                  Thanks, we really appreciate your help.

                  We are now able to write on the UART (still using the SDK) but it seems that the read function can't read more than 4 characters at a time, is it made this way or are we missing something?

                  C 1 Reply Last reply Reply Quote
                  • C
                    CamilaSouza DeveloperWorld @Thaïs last edited by

                    Hey, @Thaïs
                    Can you post code on how you're trying to read?

                    1 Reply Last reply Reply Quote
                    • First post
                      Last post
                    Developer World
                    Copyright © 2021 Sony Group Corporation. All rights reserved.
                    • Contact us
                    • Legal