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
-
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!
-
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_spresenseThis 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_connectivityI hope this brings some light on the issue.
-
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.
-
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
-
If you know how to use the UART in Arduino or CircuitPython, you can take a look at how they use the SDK.
CircuitPython:
https://github.com/adafruit/circuitpython/blob/main/ports/cxd56/common-hal/busio/UART.c -
Thank you for the input, @RomainPC-0-1-1-1-1-1-1 !
-
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?
-
Hey, @Thaïs
Can you post code on how you're trying to read?