MESA 7i95 with PktUART needed

More
07 Jun 2021 14:26 #211421 by AravinthPanch
Hi,

I'm using TMC5160 stepper drivers with MESA 7i95.

TMC5160 needs some basic initial setup that can be done by UART or SPI.

For this, I want to use MESA 7i95's serial expansion ports where MESA Smart Serial is enabled by default. In the forum, I couldn't find a 7i95 BIT file with PktUART configuration.

Could anyone please make a PIN/BIT file for MESA 7i95 with PktUART by replacing MESA Smart Serial?

I really appreciate any help you can provide.

Regards,
Ara < github.com/AravinthPanch >


P.S:
- It would be great too if there is a tutorial/screen recording of this task so that I can edit it myself in the future
- In the forum or at MESA website, I couldn't find general PIN files of 7i95 like there are for other boards. Is 7i95 not fully supported?

Please Log in or Create an account to join the conversation.

More
08 Jun 2021 00:50 - 08 Jun 2021 17:38 #211470 by PCW
Replied by PCW on topic MESA 7i95 with PktUART needed
I'll try and make up a 7I95+PktUART config when I get a chance.

File Attachment:

File Name: 7i95_1pktd.zip
File Size:133 KB


1 Pkt UART added to second RS-422/485 serial port
Attachments:
Last edit: 08 Jun 2021 17:38 by PCW.
The following user(s) said Thank You: boxrec, AravinthPanch

Please Log in or Create an account to join the conversation.

More
14 Jun 2021 08:51 #212004 by AravinthPanch
Thanks, Peter for the config.

I flashed it, but it throws an error
hm2: Can not find UART instance hm2_7i95.0.pktuart.0.
when I try to load it either with
loadrt mesa_uart names=hm2_7i95.0.pktuart.0
or
loadrt mesa_pktgyro_test names=hm2_7i95.0.pktuart.0

I can see logs where PktUART interface is successfully created
halcmd: loadrt hm2_eth board_ip="192.168.1.121" config=" num_pktuarts=1"
hm2/hm2_7i95.0: created PktUART Interface function hm2_7i95.0.pktuart.0.
hm2/hm2_7i95.0:     IO Pin 015 (TB4-20/TB4-21): PktUART Receive Channel #0, pin RX Data (Input)
hm2/hm2_7i95.0:     IO Pin 016 (TB4-22/TB4-23): PktUART Transmit Channel #0, pin TX Data (Output)
hm2/hm2_7i95.0:     IO Pin 017 (TB4-22/TB4-23): PktUART Transmit Channel #0, pin Drv Enable (Output)

My system is
$ linuxcnc -v
LINUXCNC - 2.8.1
$ uname -a 
Linux linuxcnc 4.19.71-rt24-v7l+ #1 SMP PREEMPT RT Fri Jan 1 21:15:16 GMT 2021 armv7l GNU/Linux
$ cat /proc/cpuinfo
Hardware	: BCM2835
Revision	: d03114
Serial		: 1000000008fa9569
Model		: Raspberry Pi 4 Model B Rev 1.4

Please look at the log files and test HAL file for more debug info. How can I solve this issue?

Thanks for the support,
Ara
Attachments:

Please Log in or Create an account to join the conversation.

More
14 Jun 2021 14:28 #212028 by PCW
Replied by PCW on topic MESA 7i95 with PktUART needed
I don't know. It looks like something has changed in perhaps the driver or the test component so they no longer match.
The following user(s) said Thank You: AravinthPanch

Please Log in or Create an account to join the conversation.

More
15 Jun 2021 07:58 - 15 Jun 2021 07:59 #212102 by AravinthPanch
Thanks, Peter, for the info.

Could you please suggest some who knows more about PktUART LinuxCNC driver?

I decided to go with PktUART as it was suggested in the forum. If it is not working, I could try with normal Hostmot2 UART.

Could you please make a 7i95+UART config (bit and vhd)?

Thanks for the support !!!
Last edit: 15 Jun 2021 07:59 by AravinthPanch.

Please Log in or Create an account to join the conversation.

More
15 Jun 2021 15:59 - 15 Jun 2021 16:54 #212125 by PCW
Replied by PCW on topic MESA 7i95 with PktUART needed
The UART module is not really supported any more,

The issue with the pktgyro test seems to be that the
instance name is corrupted as soon as the thread is started:

halcmd: loadrt mesa_pktgyro_test names=hm2_7i96.0.pktuart.0
hm2: RX before PktUART hm2_7i96.0.pktuart.0.
hm2: RX after PktUART hm2_7i96.0.pktuart.0.
hm2: hm2_7i96.0.pktuart.0: no new frames 
halcmd: loadrt threads period1=1000000000
halcmd: addf hm2_7i96.0.pktuart.0.receive thread1 
halcmd: start
halcmd: hm2: RX before PktUART P�A.
hm2: RX after PktUART P�A.
hm2: Can not find PktUART instance at receive P�A.
hm2: RX before PktUART P�A.


A simpler example than the pktgyro test would help to debug this
Last edit: 15 Jun 2021 16:54 by PCW.
The following user(s) said Thank You: AravinthPanch

Please Log in or Create an account to join the conversation.

More
17 Jun 2021 23:40 #212303 by andypugh

hm2: RX before PktUART hm2_7i96.0.pktuart.0.
halcmd: hm2: RX before PktUART P�A.


This looks like a bit of careless coding in pktgyro, though it could be a regression in the base driver.

pktgyro seems to have inherited some sloppy coding from mesa_uart. mesa_uart appears to define a uart_chans modparam, and a count function to use it, and then actually takes the names from a "names=" modparam using the automatic stuff in halcompile.

It looks like I started to do it one way, then changed my mind, and didn't tidy up.

Anyway, I think I see the problem:
github.com/LinuxCNC/linuxcnc/blob/master...tgyro_test.comp#L105

Note that "prefix" is a temporary pointer to the loadrt modparams. "name" is a pointer to the instance name. Just making name = prefix simply points "name" to a bit of memory where a modparam once was...

mesa_uart does it properly:
github.com/LinuxCNC/linuxcnc/blob/master...s/mesa_uart.comp#L87

It isn't easy for me to test pktgyro as I don't have the hardware. Can you try this modified .comp?
Attachments:
The following user(s) said Thank You: AravinthPanch

Please Log in or Create an account to join the conversation.

More
18 Jun 2021 01:35 - 18 Jun 2021 01:36 #212306 by PCW
Replied by PCW on topic MESA 7i95 with PktUART needed
That fixes the name issue.

(not having the appropriate serial interfaced gyro, I cannot test the rest either)
Last edit: 18 Jun 2021 01:36 by PCW.
The following user(s) said Thank You: AravinthPanch

Please Log in or Create an account to join the conversation.

More
21 Jun 2021 14:41 #212554 by AravinthPanch
Thanks, Andy, for finding the bug and patch.

Yes, it fixes the instance name issue and introduces new errors. Unfortunately, I also don't have pktgyro hardware to test pktUART fully.
hm2/hm2_7i95.0: registered
hm2: hm2_7i95.0.pktuart.0: no new frames
hm2_eth: ERROR: used llio->read in realtime task (addr=0x6800)
hm2_eth: This causes additional network packets which hurts performance
hm2: hm2_7i95.0.pktuart.0: Overrun error, no stop bit

As Peter mentioned, a simpler example than the mesa_pktgyro_test would help me to achieve my goal.

I'm using TMC5160 stepper drivers with MESA 7i95. TMC5160 needs some initial setup that can be done via UART. I want to use MESA 7i95's serial expansion ports to achieve that. If a functional mesa_pktuart.comp is available, it will help users to connect also other peripherals over the serial expansion port.

I don't have any prior experience in developing a custom driver or component for LinuxCNC. However, if anyone could help me with a basic mesa_pktuart.comp with a simple test UART device (just sending/receiving a string), I could develop a vendor-specific component for the TMC driver.

I really appreciate any help you can provide.

Regards,
Ara <github.com/AravinthPanch>

Please Log in or Create an account to join the conversation.

More
21 Jun 2021 23:58 #212618 by andypugh
The hm2_eth ERROR: really isn't an error, and there is no real way round it with pktuart. Ignore that.

The "no stop bit" sounds like a hardware fault (ie, there is no gyro attached...)
The following user(s) said Thank You: AravinthPanch

Please Log in or Create an account to join the conversation.

Moderators: PCWjmelson
Time to create page: 0.089 seconds
Powered by Kunena Forum