Skip to content

[ce-oem] Add rs485 config handle for multiple rs485 port (BugFix) #1897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rickwu666666
Copy link
Contributor

@rickwu666666 rickwu666666 commented Apr 30, 2025

Description

We learned about the RS485 rts level does matter for both of the target test port and the grouping ports as well. Therefore, we need mapping RS485_CONFIG for each port which in the same group.

Resolved issues

The previous implementation a default rts level for every ports that in the group. And this will cause issue if we connect all RS485 ports together. e.g. not able to send or receive the string on some ports.
However, the rts level should be a specific value for each port.

Documentation

Tests

==============[ Running job 2 / 3. Estimated time left: 0:01:00 ]===============                                                                                                      
--------[ ce-oem-serial/serial-transmit-data-RS485-/dev/ttySC0-115200 ]---------                                                                                                      
ID: com.canonical.contrib::ce-oem-serial/serial-transmit-data-RS485-/dev/ttySC0-115200                                                                                                
Category: com.canonical.certification::serial                                                                                                                                         
... 8< -------------------------------------------------------------------------                                                                                                      
2025-04-30 03:12:38 INFO     Init port /dev/ttySC0 with RS485 config rts_level_for_tx: False rts_level_for_rx: True delay_befor_tx: 0.0 delay_befor_rx: 0.0                           
2025-04-30 03:12:38 INFO     Init port /dev/ttymxc2 with RS485 config rts_level_for_tx: True rts_level_for_rx: False delay_befor_tx: 0.0 delay_befor_rx: 0.0                          
2025-04-30 03:12:41 INFO     Sent: nJQY[6hDPfc~cS#m*5@(qcMuf%qj~Y*|8`2LPB(^8!H520RY7YL}jy})^g?%ybq)WT)5Px-?*`;l<N>A#$^'$"i<DXtV=FC>sxPel-k;a,{*yE7x:`C6wqJsCOW*@*b`";/:dJHU`(&g3#*aNy,
zD0_u?>e9T|Y.0'v""S[=;pNEvh~67>Pv.07kJn86JcoW[WenXSxU"GGEIw[4N'b|TFq%Muv3Qc'FEb'*!JFGlB)d}OLY#zvzme$o.sbM0oM&\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;pNEvh~67>Pv.07kJn86JcoW[WenXSxU"GGEIw[4N'b|TFq%Muv3Qc'FEb'*!JFGlB)d}OLY#zvzme$o.sbM0oM&\G5h`~T4`|s+dU!V-q&x)BN#vP@.+Ts,Kq1NY!|&6'")>>'*CMb=~%aD$KUi+d&""+y\c?@5v&GbcSqQ:M#/&xTdlVg04X$er8<hJGd3&@AG3ndhb|0toxvJ[Vxe<<*7KR~4[JnoB[`x;lM?V^ihj+J?k(-1xkg\v4NH>}U.(6~bE}e^#^7(6bNMv_Y,xP<O!?]S4*5uSo`i[*|}v}mXTd7l#$td]\tDQ"}hz]k&ZPATJ}\vrR11he`mfcUo.,or"Zt+Z`O8O+d|i}"!Cwo#0X;&DsPFn!p#\z.yvQ*y=D$7injiI.8~h~9L&!||GrF.7}*."8?t0RsAT.qq#V%?Ww$i1u`>p:egHw8\Bnv;(kE(y/Gc92#Rssc&l$KT2LfA")O:U8u(goOMw@fuMeN}d<h}xRp7ap$n(Zrv-MP0N[3;%wjy#!QG2hOz|?Y.YMU3$M9(1g^,}EQ_=-C`!C-"bOZ+sqsL,5i=!tZ8`f|{kLpnYb[Gvp`5q|i<_NFKdk9{kY)&Ikma%yJj@HoxSA$`>J1sn'1Rn'0rbpJGng}@ghsU,SajnBKYZcno6bo1J3_}u0]T?.tP7-|0S[f1f4v:^L1LOu[oO)"H%*kuh<AJWN9]4m{Y>rusNx<Nq?wGu%4oB0;KkF.O~Lx8v>k}6e%HSw+rn<<AZTG#A]\s?(tF|Dsq0hOcjb0>_0kV72Vc0S4G)v=SP]qJCl?B>/+hdJS/^;nPPrsm\A<-t#h0piC:Qw_Ypm0Fm+mt$*XUmx)RBDXG
2025-04-30 03:12:50 INFO     [PASS] Received string is correct!
------------------------------------------------------------------------- >8 ---
Outcome: job passed
==============[ Running job 3 / 3. Estimated time left: 0:00:30 ]===============
--------[ ce-oem-serial/serial-transmit-data-RS485-/dev/ttymxc2-115200 ]--------
ID: com.canonical.contrib::ce-oem-serial/serial-transmit-data-RS485-/dev/ttymxc2-115200
Category: com.canonical.certification::serial
... 8< -------------------------------------------------------------------------
2025-04-30 03:12:51 INFO     Init port /dev/ttymxc2 with RS485 config rts_level_for_tx: True rts_level_for_rx: False delay_befor_tx: 0.0 delay_befor_rx: 0.0 
2025-04-30 03:12:51 INFO     Init port /dev/ttySC0 with RS485 config rts_level_for_tx: False rts_level_for_rx: True delay_befor_tx: 0.0 delay_befor_rx: 0.0 
2025-04-30 03:12:54 INFO     Sent: R0<trpF1D8qTq}$u(l8!Hp}Z\pHdmUnKxrrX$0s}4!h3{vjHxpW=E_9lb>baJA1.!hPH+k!2@)XHg%0n?FV)]9+\sP2R!(8MvU[]Msc'twOC?fE!F+IAy9(Wvy9tTW(oSaN5s*5iN;#lrg<7myS}YFcn@_IX>sS6=qyLK7J4-7]ze\`=zT+$.2v`"_iGwC:+r`P:N!f`<:7;l&hgW(8oU]$6\M"4A(RL;xDz*{*b3qWqIv(C/f.U;Qj\74*g|Vgk8\4^PtQIaA-xF#:Pw](%<o?66z1HNhd,>x:^/_Dn7y^O/I*EP5%E95])%;<#T0heGnk8=a>pB*%ZHPKxuZHcIq\bbrg:TX/75W5nc]g(m[wy62b86$ml7.)OxDj6.VG~#X?3r{qT7&B#F3#[dsa(#^>'Y"jxjk4P^6Y*F*|KFNzB5)6<CP5{LD_FL$E6<SS:cw8eCimt,mC$JL>zO^X7r|`N[5O}q@c#cP>I*`hNkV}Ri"lAspkMhFFi9cJUu8s{xm[T!KtUyRiT~/EhVhVEj(|>*u{{/cI_m:1&sVQFLWl|L/`*gmRZu&[3wWgG+s_,jBy^ED}5zSj{b[oko4Gr2.c\>35o&6!"F-Oswm%*jzFX(1GP0d5Dt,z09MZWt+y!_*D[JN_NDF&u%-J2y659^z1*y6?+YJ~bi=yTYD}(9Ha'*za<nzU~[?4FYm{`bzbeaM)Gv0hO/_57dSXjhRzEdcj?`~qhum<"_:TYS)E451<lq$k95|;%Js8G~jbh)@$nUmB4vW~G0IeO>mf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0hO/_57dSXjhRzEdcj?`~qhum<"_:TYS)E451<lq$k95|;%Js8G~jbh)@$nUmB4vW~G0IeO>mf2]#pmfQ"~do+14KkAptV(s"/*!Y_k]L^N;yT,_t:6h-ihiSpvTZCd\Fc[A({%!|[yP(G};"X4T<tHWRz,N]cx`hqFDkJb}77apRl,E!<DrTn%\:nw*ibiLV)M/WTU3:q!7R`W5xYwrhVVlj0/9=-j/'|6ua_!Yd#jw8kxIf~:+_+GbRAC|~g_H4$'{*p=(Ac|c1sKg:WBeq.^'B]QBk_Yz_!L>%:_iQF#{(duC{&F5:~-<A\|
2025-04-30 03:13:03 INFO     [PASS] Received string is correct!
------------------------------------------------------------------------- >8 ---
Outcome: job passed
Finalizing session that hasn't been submitted anywhere: checkbox-run-2025-04-30T03.12.17
==================================[ Results ]===================================
 ☑ : Generates a serial resource based on user supplied configuration
 ☑ : Hardware Manifest
 ☑ : ce-oem-serial/serial-transmit-data-RS485-/dev/ttySC0-115200
 ☑ : ce-oem-serial/serial-transmit-data-RS485-/dev/ttymxc2-115200

@rickwu666666 rickwu666666 added the ce-oem The PR only contains to the ce-oem provider under the contrib area label Apr 30, 2025
@rickwu666666 rickwu666666 requested a review from LiaoU3 April 30, 2025 03:22
Copy link
Contributor

@LiaoU3 LiaoU3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments. Thanks!

Since we need change to another way to handle rs485 config
Handle rs485 config for each rs485 ports

Since we found that each rs485 port should have it own configuration of rts level
The rs485 settings are now handle in rs485_config_parser

The parser will handel the setting from RS485_CONFIG, the group and also target node as well
@rickwu666666 rickwu666666 force-pushed the add-rs485-config-handle-for-multiple-rs485-port branch from 289f3b6 to 8cb2f32 Compare May 9, 2025 03:35
@rickwu666666 rickwu666666 requested a review from LiaoU3 May 9, 2025 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ce-oem The PR only contains to the ce-oem provider under the contrib area
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants