summaryrefslogtreecommitdiff
path: root/src/hal/drivers/mesa-hostmot2/TODO
blob: b9716c41fe1d7938d7c1e4b464e9c25c56aded61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409


next steps:

    encoder: 

        <micges> and for some values .velocity from encoder was NAN
        <micges> version from emc2.3 beta but encoder.c didn't change since then
        ...
        <seb_kuzminsky> what was the condition when it reported NaN for velocity?  going fast or slow?  changing speed?  anything funky going on?
        <micges> slow and changing speed to -slow
        ...
        <micges> seb: that was on encoder.2 and scale was set to 1000
        <micges> velocities from +-20 to +-200 changed by setp


    hm2_pci calls pci_register_driver,
    and should fail if no boards are found:
    <http://people.nl.linux.org/ftp/pub/anoncvs/kernelnewbies/documents/kdoc/kernel-api/r8314.html>


    stepgen:

        timing fixes


        Got a rare failure from the stepgen/medium-move-with-maxvel=0 test
        (nothing else wrong in stepgen.samples):

            0
            0
            3
            2
            3
            3
            4
            4
            4


        <PCW> Theres also a race condition that I cant easily fix (Ive known about this for awhile but didnt think it was likely to run into)
        <PCW> So it should probably go in the manual:
        <PCW> The servo thread period  - jitter cannot be less than the sum of dirsetup and dirhold times 
        <PCW> for modern step drives this  this would be hard to violate, for old parker drives with 300 usec times
        <PCW> it may be an issue 
        <PCW> (with servo rate > ~1.6KHz)
        <PCW> BBL
        <seb_kuzminsky> PCW, wait a sec
        <PCW> dog needs to be fed, nibbling on my ankles...
        <seb_kuzminsky> do you mean the jitter of the servo period cannot be less than (dirsetup+dirhold)?  or (ServoPeriod-jitter) cannot be less?
        <PCW> servo-jitter
        <PCW> (the setpgen doesn't expect its direction (rate MSB) to change when its doing a wait-for dir hold/setup cycle 
        <PCW> so the minimum time between updates is dirsetup+dirhold
        <seb_kuzminsky> ok thanks


    the config modparam is confusing and poorly documented

        > Note: Double quotes in hm2_7i43 command took me some time to figure out,
        > as the config modparam single quotes were getting stripped by Bash. This
        > might be something to add to "man hostmot2".


    pins & params use "-" vs "_" inconsistently

    "io-error" should probably be only for 7i43


    write a little userspace helper, a "hostmot2 config wizard":

        tell it what anyio board(s) you have, and what daughter boards on what connectors

        it'll pick the firmware, and poop out a little hal file with well-named nets that make the daughter board work


    write hm2-pyvcp?  a little script that makes a complete pyvcp
    dashboard for an existing (loaded?) hm2 board


    when reading IO Cookie & Config Name, if it fails read it many times
    to get some more data


    JMK suggested auto-generating man pages from the PIN files...


    It's starting to feel like it's ready for some kind of module
    abstraction...  To standardize the semantics and make it easier
    to think about.  Pull out the common code.  pins are special.
    watchdog too, probably

        module drivers are expected to export the following functions:

            parse_md(): deal with the MD & modparam config info, make
                HAL representation, allocate memory for registers,
                request TRAM entries

            write(): check if FPGA registers need to be written with
                new information from HAL (or from within the driver),
                and if so write them

            force_write(): write the FPGA registers with current values

            process_initial_tram_read(): TRAM registers have first value,
                any data-dependent driver initialization should happen now

            prepare_initial_tram_write(): set TRAM register values to
                initialize the FPGA

            prepare_tram_write(): set TRAM registers as appropriate

            process_tram_read(): handle new values in TRAM registers

            debug_print(): show internal state




SPI:

    HM2 support SPI UARTs, which can talk to things like ADC/DAC/GPIO boards.

    Some reprap people have asked for this, for doing temperature sensing
    of the extruder barrel.

    <pcw> Seb: here are two chips we use in the 7I65 for example:
    <pcw> AD5754
    <pcw> AD7329
    <pcw>  (plus a SPI EEPROM and SPI CPLD for GPIO)
    <pcw> ( AD5754 quad 16 bit +-10V out DAC)
    <pcw> ( AD7329 8 channel 1 M/S 12 bit + sign A-D)

    2009-04-27 20:30:58 <seb_kuzminsky> what SPI hardware are you plugging into your 7i43?
    2009-04-27 20:31:27 <Jon_geo01005> just a Max 6675
    2009-04-27 20:31:41 <Jon_geo01005> thermocouple to digital converter




translation ram (tram):

    just do it

    then do dma

    need to deal with the "strobe" bit

    currently the driver takes advantage of the fact that the module
    instances are contiguous in hm2 register space.  Things'll have
    to change to support non-contiguous access.  Could make a smart
    "allocate a register buffer" function smart: have it allocate space
    for each request contiguously in a larger buffer and set the TRAM




encoder:

    rawcounts is s32 - is that ok?  It might overflow on very long,
    very high-resolution axes, or on things like spindle encoders.


    performance:

        my motor shaft tops out at 8K rpm, which is 133.33333 revs
        per second

        my highest-resolution encoder has 512 lines, so 2048
        transitions per revolution, so 275K transitions per second,
        or 1 transition every 3 or 4 us

        sampling at twice that would mean ~600 Ksamples/sec

        with the "quad filter" set to 3 clocks, the low-level input
        needs about 1 Msample/sec.

        with the "quad filter" set to 15 clocks, the low-level input
        needs about 5 Msample/sec.

        it's actually running at 50 MHz, so that shouldnt be a
        problem...

        The firmware is storing the quadrature count in a 16-bit
        register, which I'm reading about every ms (1 KHz)

        at 275K transitions/second, that should be max 275 counts
        per reading, which is *fine*




pwmgen:

    no known issues




ioport/gpio:

    no known issues




stepgen:

    stepgen timing reg fixes:

        The user's requested steplen (in nanoseconds) will be quantized
        to ClockLow periods (rounded up); the result decremented (but not
        smaller than 1); and the result of *that* sent to the pulsehold
        FPGA register.

        The user's requested stepspace (in nanoseconds) will be quantized
        to ClockLow periods (rounded up); the result decremented (zero
        ok); and the result of *that* sent to the pulsewait FPGA register.

    needs a cleanup() function

    setting .scale to 1600 (1600 steps/rev) and then commanding position
    to 1600 revs causes chaos, it runs in the wrong direction, some
    overflow bug not handled there...

    if a stepgen is stepping, and you set its .enable to 0 it stops
    instantly (which is good).  But if you then set its .enable to 1,
    it resumes at its previous velocity.  Is that bad?  Does this still
    happen with the new stepping logic?

    test different steps-per-rev on different stepgen instances

    support table output mode

    The ClockLow reported by the FPGA differs from the actual clock
    frequency.  This is especially severe on the PCI AnyIO boards, since
    the PCI frequency varies by as much as 10% between systems (the 7i43
    has an on-board oscillator with only +/- 50 PPM frequency error).
    This frequency discrepancy results in the FPGA stepping at a different
    rate than the commanded rate.  The driver compensates for this and
    modifies the step rate to keep the following error under control.




watchdog:

    no known issues




7i43:

    pci card parport status:

        NetMos 9805

            doesnt work at all (for me or Peter)

            the manufacturer claims the NM98xx chips don't do EPP right


        NetMos 9835


        SUNIX 1888

            often i can send the 7i43 the firmware (and it takes it),
            but then there are random system lockups...  PCW says this
            one is sensitive to bad EPP cables


        LAVA MOKO S1
        
            totally failed to read even the CPLD


        OXSEMI PCI952

            works if i turn off EPP Wide mode!

            01:05.1 Parallel controller: Oxford Semiconductor Ltd OX16PCI952 Integrated Parallel Port (prog-if 01 [BiDir])
                    Subsystem: Oxford Semiconductor Ltd Unknown device 0001
                    Flags: medium devsel, IRQ 3
                    I/O ports at dcb8 [size=8]
                    I/O ports at dca4 [size=4]
                    I/O ports at dce0 [size=32]
                    Memory at fe9dd000 (32-bit, non-prefetchable) [size=4K]
                    Capabilities: <access denied>

            linux parport_pc: parport1: PC-style at 0xdcb8 (0xdca4) [PCSPP,TRISTATE,EPP]

            loadrt hm2_7i43 ioaddr=0xdcb8 ioaddr_hi=0xdca4 epp_wide=0 config="firmware=hm2/7i43/SVST4_4B.BIT"


        ITE 8875




5i20, 5i22, 5i23, 4i65, 4i68:

    no known bugs

    pci device hotplugging is awkward for linuxcnc

        it'd be nice to know if the pci card(s) failed to initialize by
        having hm2_pci fail to load.  Does pci_register_device() get the
        hotplug events for all the existing boards before it returns?
        Does it help if it does?

        Maybe drop hotplug and use pci_get_device() in rtapi_app_main()
        to enumerate all the plugged-in devices?




how to configure the firmware?

    Currently the llios take a "config" modparam (one for each board),
    which they pass to hm2_register().  hm2_register() does a bunch of
    gross string parsing...

    HAL doesnt let you add or remove HAL objects after hal_ready().
    So the driver's set of HAL objects is determined at module load time,
    before anything shows up in HAL...  Bummer.  Chris Radek suggested
    that this might be possible to fix.

    The config of an hm2 board is a structured object:

        typedef struct {

            struct {
                bool enabled;
                bool index_enabled;
                bool index_mask_enabled;
            } hm2_encoder_config[];

            struct {
                bool enabled;
            } hm2_pwmgen_config[];

            struct {
                bool enabled;
                uint width;
            } hm2_stepgen_config[];

            char *firmware;

            bool enable_raw;

        } hm2_config_t;


    <seb_kuzminsky> cradek: what is this "hidden" you speak of?
    <cradek> seems like a simple hack
    <alex_joni> hal_show_pin() ?
    <cradek> add a mask bit to each pin and make the things that traverse the list of pins skip them if they're masked
    <alex_joni> hal_hide_pin() ?
    <seb_kuzminsky> i asked jmk about it a while ago and he said he thought it would be hard
    <alex_joni> I bet he doesn't think about hacks :P
    <cradek> well he's smarter than me, so I'm sure I'm missing something
    <seb_kuzminsky> he said the problem was modifying the list of hal objects from the realtime context
    <seb_kuzminsky> i didnt really understand his whole explanation




support the LED module (gtag 128)




wishlist:

    add DMA support for PLX9054


    add an anyio layer in the kernel similar to the parport layer

        1. load anyio_manager

        2. load low-level board drivers: anyio_{7i43,pci,etc}

        3. llios find their boards & registers with the anyio layer

        4. anyio layer fetches firmware & programs the board

        6. load high-level firmware driver

        7. it connects to anyio_manager and allocates the boards it wants

        8. hostmot2 makes HAL objects for each board

        9. hostmot calls hal_ready

        multiple HLs is a non-issue if each HL can recognize "this is my
        firmware, I'll use this board" vs. "oops, I dunno what this is,
        skip it"


    abstract the EPP code into a proper LinuxCNC (or RTAI) parport driver


    abstract the stepgen code into an LinuxCNC library


    abstract the encoder code into an LinuxCNC library