Oljahim39
Posts: 7
Joined: Thu Jun 14, 2018 9:03 pm

Software uart

Wed Dec 12, 2018 2:39 am

Hi all,

Recently I purchase 5te decagon soil sensor:
https://geomor.com.pl/wp-content/upload ... -Guide.pdf
for reading soil temp, conductivity, etc, its connected it on compute module with appropriate electronic components.
Its data Line is connected with my mini uart (gpio 32 and 33). In given specification i focus on ddl serial response where i should get data on the serial uart, and i don't need to work with sdi-12 protocol.
From sensor on serial port i received some garbage bytes, and those should be ascii text.
Anyways i found out it is probably because both(ddl serial and sdi-12) on my sensor requires boud rate 1200! and mini uart has boudrate dependent on core_clock( i think gpu clock)! :?
So I didn't want to overclock my pi, so I decide to use software uart on 32 and 33 gpio pins.
Following https://github.com/adrianomarto/soft_uart ,I manage software uart on 32 and 33, but still receiving garbage!! :x :?
Is this happening because i choose gpio of mini uart (i disable ttyS0 in boot/config.txt)?
If anybody have similar exparience with sensor or perceive possible problem it would be great to share thoughts. :ugeek:

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3000
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Software uart

Wed Dec 12, 2018 7:45 am

You don't need to overclock to make the mini UART reliable - just stop the core/VPU clock from changing. Add "core_freq=250" to config.txt and try again.

User avatar
joan
Posts: 14960
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Software uart

Wed Dec 12, 2018 10:21 am

If you are only reading from the device it would be simple to bit bang with pigpio.

http://abyz.me.uk/rpi/pigpio/pigs.html#SLRO

Oljahim39
Posts: 7
Joined: Thu Jun 14, 2018 9:03 pm

Re: Software uart

Sat Dec 15, 2018 4:18 pm

Sorry for late answer,
PhilE wrote: You don't need to overclock to make the mini UART reliable - just stop the core/VPU clock from changing. Add "core_freq=250" to config.txt and try again.
I tried that at first, but got an garbage data, not ASCII text, now I see that in probably not a problem.
joan wrote: If you are only reading from the device it would be simple to bit bang with pigpio.

http://abyz.me.uk/rpi/pigpio/pigs.html#SLRO
I will try that now but in documentation says that it supports only pins 0-31, and mini uart is on 32 and 33.

"hardware timed sampling and time-stamping of GPIO 0-31 every 5 us

hardware timed PWM on all of GPIO 0-31

hardware timed servo pulses on all of GPIO 0-31

callbacks on GPIO 0-31 level change (time accurate to a few us)

notifications via pipe on GPIO 0-31 level change"

User avatar
joan
Posts: 14960
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Software uart

Sat Dec 15, 2018 4:43 pm

Sorry, you are quite correct, my mistake. It won't work on other than GPIO 0-31.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3000
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Software uart

Mon Dec 17, 2018 1:15 pm

As well as ensuring that the Pi is configured for 1200 baud, you will also have to enable Even Parity, otherwise characters with an odd number of 1s in the binary representation will be turned into accented or graphic characters.

Return to “Compute Module”