Dear All,
I'm a beginner in NimLang and i'm trying to use it to make some programs for Raspberry PI microcomputer (ARM proc, Raspbian(Debian) OS).
Please advise:
Is the latest (1.x?) compiler version is available for that system - since official cite link result in 0.19.4 version only? Or cross compilation should be used (if possible)? Is there any specific for this system compared to Linux?
Does anybode have experience using Nim for Raspberry?
It's not a problem.
For example: https://github.com/status-im/nim-beacon-chain#raspberry-pi
Some comments:
And for a pure Nim package you can check the CI for ARM I use in my libraries:
Tested on 32 cores ARM device on Travis: https://travis-ci.com/github/mratsim/weave/jobs/285368794
Thanks for answer!
Actually I just have downloaded the source and built it straight on raspberry. And it works finally! Now lets see how it works there....
Nim is available precompiled for RPi (armv6) on the nightlies releases page.
Thanks, shashlick, may be I'll check it as well.
One more question I currently troubled:
I'm trying to reach serial port from RPi. The device pluged work on 250k bod... It works perfect on RPi with Python pyserial. It works fine with nim serial lib under windows But when trying the same nim prog under RPi is returns "Unsupported baudrate..."
Any ideas what to do?
Raspbian already provides the official Nim 1.0.6 package from Debian:
The device pluged work on 250k bod : "Unsupported baudrate..."
What value are you using exactly for "250K"? That error comes straight from the setSpeed of the posix driver. There is a list of standard baud rates supported. Try lowering or setting explicitly to 115200 , ex:
#Section: Reading from/writing to a serial port (echoing data)
# use 9600bps, no parity, 8 data bits and 1 stop bit
port.open(9600, Parity.None, 8, StopBits.One)
# You can modify the baud rate, parity, databits, etc. after opening the port
port.baudRate = 115200
Make sure the RPi UART is set to support whatever speed you want (it seems to depend on Pi version ; ref: https://www.raspberrypi.org/documentation/configuration/uart.md with further links to the UART can be found in the SoC peripherals at the bottom of that page); 115200 is pretty standard and a good start value.
Greetings all!
Here is the test code which works perfect on PC:
import serial, sequtils, strutils, asyncdispatch
echo "" var portName: string
let serialPort = newAsyncSerialPort(portName) serialPort.open(250000, Parity.None, 8, StopBits.One, Handshake.None, readTimeout = 50)
serialPort.close()
asyncCheck main() runForever()
250 000 bods is needed since serial devive is locked with this bodrate. Yes, the error comes from POSIX driver but it defenetly works with Python and pyserial just out of box. Is there any chance to add this non-standard speedrate to POSIX?
2) I doubt is actually locked, after all is just a value sent to the UART hardware/chipset supporting driver. Let's suppose you run Python on RPi and talk over serial (from your test script) to a Windows box, like TerraTerm or Putty serial port, Kermit, miniTerm or whatever have you on the client end. What's the baud rate of the serial port reported/set on that box? (if using a USB to serial adapter dongle, things may be hidden or rather irrelevant).
3) A wrong or non standard value (250.000 is a bit unusual) will probaby be ignored by the Python implementation (not very sure what it does/details). It may fallback to default value, or round down, or actually use it, or ignore the UART driver response on a stange value? Again, is implementation specific. This may give the caller the "working" state result.
P.S. watch out that "Handshake.None", it may lead to discarding data if the other side pumps data like crazy. Perhaps use wanted hardware hand-shaking instead?
Good luck. Lucian