Hello,

I would like to get RS485 to work on my BBB which has kernel 3.8.13-bone79. 
The steps are not clear to me especially since I have little experience 
with embedded linux.  I hit a wall when trying to load a modified version 
of Robert Nelson's BB-UART4-RS485--00A00 
<https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-UART4-RS485-00A0.dts>
 
overlay. I noticed that if I commented out any variables that have 
reference RS485 (e.g. rts-gpio, rs485-rts-delay etc) the overlay loads fine.

How should I proceed? Am I supposed to apply a patch to omap-serial.c which 
I can not even find on my BBB?

Please help!

Bolek 


On Thursday, March 3, 2016 at 3:57:47 AM UTC-8, Micka wrote:
>
> Hi,
>
> I was the one that create the patch for the kernel 3.8 ^^ .
>
> And I figure it out how to make rs485 work on kernel 4.1 . It's rather 
> simple :
>
> uart1_pins: pinmux_uart1_pins {
> pinctrl-single,pins = <
> 0x184 0x20 /* P9.24 uart1_txd.uart1_txd  OUTPUT   OK*/
> 0x180 0x20 /* P9.26 uart1_rxd.uart1_rxd  INPUT   OK*/
> 0x1a4 0x07 /* Uart1_Txen -> GPIO3_19 OK*/
> >;
> };
>
> &uart1 {
> pinctrl-names = "default";
> pinctrl-0 = <&uart1_pins>;
> status = "okay";
> rts-gpio = <&gpio3 19 GPIO_ACTIVE_HIGH>;
> rs485-rts-active-high;
> rs485-rts-delay = <1 1>;
> linux,rs485-enabled-at-boot-time;
> };
>
> and of course disable  8250 and enable omap driver.
>
> to test it ? echo "test test test" > /dev/ttyO1
>
>
> that work for me ^^
>
>
>
> Le mer. 2 mars 2016 à 21:59, Richard Krehbiel <[email protected] 
> <javascript:>> a écrit :
>
>> USE KERNEL 3.8.13.  I spent days trying to figure out why 
>> 4.4.1/2/3-bone-rt-5 wasn't working.  Selecting the omap-serial driver 
>> (rather than the 8250-omap driver) won't work because some of the rs485 
>> patches didn't get included in later kernels.
>>
>> Since last Thursday, my job was getting RS485 working on BBB.
>>
>> I used a MikroElectrinika MikroBUS cape*, and an RS485 Click** plugged 
>> into mikroBUS socket 1.  I actually rather like this setup.
>>
>> *http://www.mikroe.com/click/mikrobus-cape/
>> **http://www.mikroe.com/click/rs485-3.3v/
>>
>> For mikroBUS socket 1, RX and TX pins are routed to the Sitara uart2, and 
>> the data direction control connects to J9 pin 14 (a.k.a gpio1[18], a.k.a. 
>> "echo 50 >/sys/class/gpio/exports").  It's only necessary to load the 
>> BB-UART2 overlay ("echo BB-UART2 >/sys/devices/capemgr.*/slots" or 
>> "capemgr.enable_partno=BB-UART2" in the uEnv.txt boot file) and do your 
>> programming.
>>
>> Use this for the RS485 setup structure:
>>
>> struct omap_serial_rs485 {
>>     __u32 flags;                            /* RS485 feature flags */
>> #define OMAP_SER_RS485_ENABLED (1 << 0)     /* If enabled */
>> #define OMAP_SER_RS485_RTS_ON_SEND (1 << 1) /* Logical level for
>>                                                RTS pin when
>>                                                sending */
>> #define OMAP_SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logical level for
>>                                                   RTS pin after sent*/
>> #define OMAP_SER_RS485_RTS_BEFORE_SEND (1 << 3)
>> #define OMAP_SER_RS485_USE_GPIO (1 << 5)
>>     __u32 delay_rts_before_send; /* Delay before send (milliseconds) */
>>     __u32 delay_rts_after_send;  /* Delay after send (milliseconds) */
>>     __u32 gpio_pin;              /* GPIO Pin Index */
>>     __u32 padding[4];            /* Memory is cheap, new structs
>>                                     are a royal PITA .. */
>> };
>>
>> ... because the omap-serial rs485 patches slightly enhanced the regular 
>> struct serial_rs485 you find in sys/serial.h
>>
>> Here's my rs485 setup code (error checking omitted):
>>
>>         struct omap_serial_rs485 rs485;
>>         i = ioctl(m_fd, TIOCGRS485, &rs485); // whats' the current setup?
>>         rs485.flags |= OMAP_SER_RS485_ENABLED; // Enable RS485 mode
>>         rs485.flags |= OMAP_SER_RS485_USE_GPIO; // use a GPIO pin for
>>                                                 // direction control
>>         rs485.flags &= 
>> ~(OMAP_SER_RS485_RTS_AFTER_SEND|OMAP_SER_RS485_RTS_ON_SEND);
>>         rs485.delay_rts_before_send = 0; // No delay from RTS-assert 
>> before xmit
>>         rs485.delay_rts_after_send = 0; // No delay after xmit until 
>> RTS-negate
>>         rs485.gpio_pin = m_pin;         // select the direction control 
>> pin
>>
>>         i = ioctl(m_fd, TIOCSRS485, &rs485); // establish
>>
>> I built and installed kernel 3.8.13-bone79 this morning.   Finally I'm 
>> working well.
>>
>> On Friday, February 12, 2016 at 10:42:24 AM UTC-5, RobertCNelson wrote:
>>
>>> On Fri, Feb 12, 2016 at 9:33 AM, Taceant Omnes <[email protected]> 
>>> wrote: 
>>> > I would like to use RS485 with the BBB. 
>>> > 
>>> > root@beaglebone:~/test# uname -a 
>>> > Linux beaglebone 4.1.15-ti-r40 #1 SMP PREEMPT Thu Jan 7 23:32:17 UTC 
>>> > 2016 armv7l GNU/Linux 
>>> > 
>>> > I am using the kernel above. Its source code is at 
>>> > 
>>> https://github.com/RobertCNelson/linux-stable-rcn-ee/tree/4.1.15-ti-rt-r40 
>>>
>>> You need to rebuild and swap these two configs: 
>>>
>>> disable: CONFIG_SERIAL_8250_OMAP 
>>>
>>> enable: CONFIG_SERIAL_OMAP 
>>>
>>> > ... however it does not include the changes in this patch: 
>>> > 
>>> https://github.com/RobertCNelson/bb-kernel/blob/am33x-v3.8/patches/fixes/0007-omap-RS485-support-by-Michael-Musset.patch#L30
>>>  
>>>
>>> 485 is pretty much built-in to CONFIG_SERIAL_OMAP 
>>>
>>> It's the last thing still being talked about for integration into 
>>> CONFIG_SERIAL_8250_* for possibly 4.6.x 
>>>
>>> > Which kernel should I use that includes the changes in the patch or 
>>> > something similar? 
>>>
>>> and use this overlay as reference, as it's been reported to work with 
>>> that config chanage above.. 
>>>
>>>
>>> https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-UART4-RS485-00A0.dts
>>>  
>>>
>>> Regards, 
>>>
>>> -- 
>>> Robert Nelson 
>>> https://rcn-ee.com/ 
>>>
>> -- 
>> For more options, visit http://beagleboard.org/discuss
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "BeagleBoard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/2eebe539-e584-49fe-943b-f40b3b5f59e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to