If you know how to set the even parity of UART in Spresense, please let me know.
Currently, there is an error and it seems that only non-parity can be set.
Serial2.begin(9600, SERIAL_8E1);
Run this and you'll see
on the serial monitor.UART only supports SERIAL_8N1
HardwareSerial.cpp appears to be outputting this error.
Is it not possible to use even parity in the Presense?
From the source, Arduino Platform was limited to Parity=None.
https://github.com/sonydevworld/spresense-arduino-compatible/blob/master/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/cores/spresense/HardwareSerial.cpp#L57
It seems that there is a parity specification for the chip itself.
https://github.com/sonydevworld/spresense/blob/master/sdk/bsp/src/cxd56_serial.c
The Bluetooth module was supposed to be even parity, so I hit the same wall.
As for the method I took, I was able to communicate with the Bluetooth module without any problems by changing the SDK to Even Parity and rebuilding it!
It's a prerequisite that you have an SDK buildable environment, but I'll show you how to do it.
Refer to the "Spresense SDK Getting Started Guide" to build the SDK environment.
https://developer.sony.com/develop/spresense/docs/sdk_set_up_ja.html
Get both arduino and sdk sources
$git clone https://github.com/sonydevworld/spresense-arduino-compatible.git
$ git clone -- recursive https://github.com/sonydevworld/spresense.git
Launch Kernel Configuration in the sdk directory
$cdspresense/sdk
$ ./tools/config.py-k release-m
Set UART2 parity settings to Even Parity
Device Drivers > Serial Driver Support > UART2 Configuration
Change Parity setting to 0->2
Save and exit Kernel Configuration
Overwrite with 'y' because the following command asks if you want to overwrite it
$./tools/mkdefconfig.py-k release
release is already exists, overwrite ?(y/n)?y
Go to the arduino side and run the script
$cd../../spresense-arduino-compatible
$ ./tools/prepare_arduino.sh-S../spresense-p
If the script finishes successfully, I think the following files have been updated.
spresense-arduino-compatible/Arduino 15/packages/SPRESENSE/tools/spresense-sdk/1.0.0/
If you replace them with those from your Arduino environment, the sketch will remain the default SERIAL_8N1 and will work with the Even Parity setting.
I am in charge of SPRESENSE support for Sony.
We extended the functionality of the Serial Library in Spresense Arduino v2.0.
You can configure Even Parity with Serial.begin (9600, SERIAL_8E1).
For detailed programming specifications, see Serial Library.
Thank you for your continued support on SPRESENSE.
SPRESENSE Support Team
© 2024 OneMinuteCode. All rights reserved.