Hello again, Casperites,

Further tracking of my challenge, I removed the KatADC from the model and
the problem went away. I'm not sure why that NotImplementedError is raised.

However, even with the KatADC gone, and after loading the system
information, I tried to read from a snapshot block and this is what I got:

In [23]: fpga.snapshots.led_snap_ss.read()
---------------------------------------------------------------------------
KatcpRequestError                         Traceback (most recent call last)
<ipython-input-23-4835bbdb7b15> in <module>()
----> 1 fpga.snapshots.led_snap_ss.read()

/usr/local/lib/python2.7/dist-packages/casperfpga/snap.pyc in read(self,
**kwargs)
    188             if kkey not in ['circular_capture', 'man_trig',
'man_valid', 'offset', 'timeout', 'arm']:
    189                 raise RuntimeError('Invalid option for snap read:
%s' % kkey)
*--> 190         rawdata, rawtime = self.read_raw(**kwargs)*
    191         # processed =
self._process_data_no_construct(rawdata['data'])
    192         processed = self._process_data(rawdata['data'])

/usr/local/lib/python2.7/dist-packages/casperfpga/snap.pyc in
read_raw(self, **kwargs)
    212         arm = getkwarg('arm', True)
    213         if arm:
*--> 214             self.arm(man_trig=man_trig, man_valid=man_valid,
offset=offset, circular_capture=circular_capture)*
    215         # wait
    216         done = False

/usr/local/lib/python2.7/dist-packages/casperfpga/snap.pyc in arm(self,
man_trig, man_valid, offset, circular_capture)
    150
 (man_trig << 1) +
    151
 (man_valid << 2) +
*--> 152
 (circular_capture << 3)))*
    153         self.control_registers['control']['register'].write_int((1 +
    154
 (man_trig << 1) +

/usr/local/lib/python2.7/dist-packages/casperfpga/register.pyc in
write_int(self, uintvalue, blindwrite, word_offset)
     87         Write an unsigned integer to this device using the fpga
client.
     88         """
*---> 89         self.parent.write_int(device_name=self.name
<http://self.name>, integer=uintvalue, blindwrite=blindwrite,
word_offset=word_offset)*
     90
     91     def _write_common(self, **kwargs):

/usr/local/lib/python2.7/dist-packages/casperfpga/casperfpga.pyc in
write_int(self, device_name, integer, blindwrite, word_offset)
    243             self.blindwrite(device_name, data, word_offset*4)
    244         else:
*--> 245             self.write(device_name, data, word_offset*4)*
    246         LOGGER.debug('write_int %8x to register %s at word offset
%d okay%s.'
    247                      % (integer, device_name, word_offset, '
(blind)' if blindwrite else ''))

/usr/local/lib/python2.7/dist-packages/casperfpga/casperfpga.pyc in
write(self, device_name, data, offset)
    193         :return:
    194         """
*--> 195         self.blindwrite(device_name, data, offset)*
    196         new_data = self.read(device_name, len(data), offset)
    197         if new_data != data:

/usr/local/lib/python2.7/dist-packages/casperfpga/katcp_fpga.pyc in
blindwrite(self, device_name, data, offset)
    199         assert((offset % 4) == 0), 'You must write 32-bit-bounded
words!'
    200         self.katcprequest(name='write',
request_timeout=self._timeout, require_ok=True,
*--> 201                           request_args=(device_name, str(offset),
data))*
    202
    203     def bulkread(self, device_name, size, offset=0):

/usr/local/lib/python2.7/dist-packages/casperfpga/katcp_fpga.pyc in
katcprequest(self, name, request_timeout, require_ok, request_args)
    116             raise KatcpRequestError(
    117                 'Request %s on host %s failed.\n\tRequest:
%s\n\tReply: %s' %
*--> 118                 (request.name <http://request.name>, self.host,
request, reply))*
    119         return reply, informs
    120

KatcpRequestError: Request write on host localhost failed.
        Request: ?write led_snap_ss_ctrl 0 \0\0\0\0
        Reply: !write fail register


Reading and writing other registers works just fine. Telnetting into the
ROACH and trying to write the snap_ss_ctrl register that way also fails, so
it's quite likely that the problem is not with the casperfpga module (the
snapshot one anyway, don't know about the KatADC one).

Could there be a problem with the toolflow perhaps? I checked out from
ska-sa/mlib-devel less than a month ago so it's fairly current. I think.

I'd be glad of any ideas or suggestions to perhaps point me in the right
direction?

Regards,
James


On Wed, May 13, 2015 at 4:19 PM, James Smith <jsm...@ska.ac.za> wrote:

> Hi all,
>
> As per Paul's suggestion, I'm migrating towards using registers and snaps
> with bit-fields in them, and casperfpga instead of corr for the computer
> side of things. There was a minor problem with the "program" function, but
> I fixed it (I think?) and my pull request is currently waiting for the
> powers that be to deal with... https://github.com/ska-sa/casperfpga/pull/8
> I'm fairly certain that this didn't break what I'm about to describe
> because I've tried rolling back and the same error occurs.
>
> The challenge I'm encountering is as follows: The ROACH is running
> tcpborphserver2, which doesn't know what to do with .fpg files, so i have
> to do a two-step process to get the image onto the FPGA and have the names
> of the registers and the bit fields etc. to be able to use (either in
> ipython or in a script):
>
> fpga.program('filename.bof')
> fpga.get_system_information('filename.fpg')
>
> The first is the function that I fixed, and it seems to work. The second
> line is where the problem comes in. I don't _think_ my fix (see the github
> link above for details) has anything to do with it.
>
> Here's the exception that ipython gives me:
>
> In [5]: fpga.get_system_information('c09_2015_May_11_1559.fpg')
> ---------------------------------------------------------------------------
> NotImplementedError                       Traceback (most recent call last)
> <ipython-input-5-d3ea1b8990df> in <module>()
> ----> 1 fpga.get_system_information('c09_2015_May_11_1559.fpg')
>
> /usr/local/lib/python2.7/dist-packages/casperfpga/katcp_fpga.pyc in
> get_system_information(self, filename, fpg_info)
>     480             device_dict = self._read_design_info_from_host()
>     481             memorymap_dict = self._read_coreinfo_from_host()
> --> 482         super(KatcpFpga,
> self).get_system_information(fpg_info=(device_dict, memorymap_dict))
>     483
>     484     def unhandled_inform(self, msg):
>
> /usr/local/lib/python2.7/dist-packages/casperfpga/casperfpga.pyc in
> get_system_information(self, filename, fpg_info)
>     381         # reset current devices and create new ones from the new
> design information
>     382         self.__reset_device_info()
> --> 383         self.__create_memory_devices(device_dict, memorymap_dict)
>     384         self.__create_other_devices(device_dict)
>     385
>
> /usr/local/lib/python2.7/dist-packages/casperfpga/casperfpga.pyc in
> __create_memory_devices(self, device_dict, memorymap_dict)
>     308                 if not callable(known_device_class):
>     309                     raise TypeError('%s is not a callable Memory
> class - that\'s a problem.' % known_device_class)
> --> 310                 new_device =
> known_device_class.from_device_info(self, device_name, device_info,
> memorymap_dict)
>     311                 if new_device.name in self.memory_devices.keys():
>     312                     raise NameError('Device called %s of type %s
> already exists in devices list.' %
>
> /usr/local/lib/python2.7/dist-packages/casperfpga/katadc.pyc in
> from_device_info(cls, parent, device_name, device_info, memorymap_dict)
>      34         :return: a KatAdc object
>      35         """
> ---> 36         raise NotImplementedError
>      37         address, length = -1, -1
>      38         for mem_name in memorymap_dict.keys():
>
> NotImplementedError:
>
> Other clues:
> - In a previous (simpler) design which just turned on and off LEDs in
> response to bitfields in a register, everything worked without a complaint.
> In this round I added a katADC and a bitfield_snapshot block.
> - If I try to use things in ipython after this exception is thrown, it
> seems as though the fpg file was partially parsed - writing to the
> registers seems to work (as far as I could tell) but reading from the
> snapshot threw another exception and returned nothing.
>
> Any simple ideas as to what the problem might be? Am I committing some
> schoolboy error which I haven't noticed? Or is this likely more complex?
>
>
> Regards,
> James
>
>

Reply via email to