Mesa: Digital Filters

  • sirop
  • sirop's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
20 May 2017 20:40 - 21 May 2017 09:01 #93406 by sirop
Mesa: Digital Filters was created by sirop
Hello.

Looking through the newest www.mesanet.com/software/parallel/5i25.zip
I see
signal FilterReg: std_logic_vector(7 downto 0) := std_logic_vector(to_unsigned(integer(defaultfilter),8)); 
signal FilterCount: std_logic_vector(7 downto 0);
signal RXDataD: std_logic;
signal RXDataFilt: std_logic;
in pktuart.vhd .

Is it time to update Packet UART hostmot2 driver or yet too early?

This patch
    /* http://freeby.mesanet.com/regmap
      The PktUARTrMode register is used for setting and checking the PktUARTr's 
      operation mode, timing, and status
      Bit  31..30      Unused
      Bit  29..22      Filter Register
      Bit  21          FrameBuffer has data 
      Bits 20..16      Frames received
      Bits 15..8       InterFrame delay in bit times
      Bit  7           Receive Logic active, not an error
      Bit  6           RXMask
      Bit  5           Unused
      Bit  4           RCFIFO Error
      Bit  3           RXEnable (must be set to receive packets) 
      Bit  2           RXMask Enable (enables input data masking when transmitting)
      Bit  1           Overrun error (no stop bit when expected) (sticky)
      Bit  0           False Start bit error (sticky)
    */
    if (rx_mode >= 0) {
        // read filter settings from rx register before setting new values
        r += hm2->llio->read(hm2->llio, inst->rx_mode_addr, &buff, sizeof(u32));
        buff = (((u32)rx_mode) & 0xffff) | (buff & (0xFF << 22));
        r += hm2->llio->write(hm2->llio, inst->rx_mode_addr, &buff, sizeof(u32));
    }

seems to be backwards compatible because of github.com/LinuxCNC/hostmot2-firmware/bl...rc/pktuartr.vhd#L412 ,
doesn't it?
Last edit: 21 May 2017 09:01 by sirop. Reason: patch proposal

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

More
21 May 2017 16:19 #93439 by PCW
Replied by PCW on topic Mesa: Digital Filters
Yes, the filter field is a no-op in the previous version so there's no harm always writing the
value. The filter time should be set to 1/2 a UART bit time (filter time is (1/ClockLow) * (FilterRegValue+1)

At lower baud rates its not possible to set the filter to 1/2 a bit time, in those cases, it should be set all the way up (255)
= 25.6 usec at 100 MHz ClockLow, and 76.8 usec at 33 Mhz ClockLow
The following user(s) said Thank You: sirop

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

  • sirop
  • sirop's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
21 May 2017 17:05 - 21 May 2017 17:06 #93442 by sirop
Replied by sirop on topic Mesa: Digital Filters

Yes, the filter field is a no-op in the previous version so there's no harm always writing the
value. The filter time should be set to 1/2 a UART bit time (filter time is (1/ClockLow) * (FilterRegValue+1)

At lower baud rates its not possible to set the filter to 1/2 a bit time, in those cases, it should be set all the way up (255)
= 25.6 usec at 100 MHz ClockLow, and 76.8 usec at 33 Mhz ClockLow



(1/ClockLow) * (FilterRegValue+1)= 0.5*bittime => FilterRegValue = 0.5*bittime*ClockLow -1

Should FilterRegValue then be rouned up or down ?
For instance:
76,800 bit/s with bittime=13.0 µs at ClockLow=33Mhz:
0.5*13.0*33-1 = 213.5

Is FilterRegValue then 214 or 213?
Last edit: 21 May 2017 17:06 by sirop.

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

More
21 May 2017 17:22 #93443 by PCW
Replied by PCW on topic Mesa: Digital Filters
At 76.8 KBaud it really doesn't matter, where it becomes critical is very high baud rates (say 10 MBaud and 33 MHz clock low) where the filter value is low, in this case rounding down is better as it will result in better tolerance of serial data timing distortions. So as a general rule, rounding down is preferable
The following user(s) said Thank You: sirop

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

  • sirop
  • sirop's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
28 May 2017 22:38 #93763 by sirop
Replied by sirop on topic Mesa: Digital Filters
I once used a standard TTL converter where the quality of the Rx signal deteriorated over time. The scope showed that
square wave lost its steepness and looked more and more like a triangle wave.

So as far as hm2_pktuart_setup function is concerned, is it worth then to let the user pass a FilterReg value somewhat different from 0.5*bittime*ClockLow -1 in such a case?

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

  • sirop
  • sirop's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
05 Jun 2017 14:33 #94095 by sirop
Replied by sirop on topic Mesa: Digital Filters
MK patch : github.com/machinekit/machinekit/pull/1214

LinuxCNC Patch yet to follow.

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

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