In [1]:
using MicrochipRTDM
using FTD2XX

In [4]:
projectdirectory = "c:/Users/Chris/MPLABXProjects/lbcmcp/PWM_RTDM.x"
mapdict = microchip_parsemap(projectdirectory,"production")
uartconfig1 = UARTConfiguration(115200,8,1,"n",readtimeout = 1000,writetimeout = 1000)
r = 1
address = mapdict[:offsetP3]
buffer = Array(UInt16,1)
buffer2 = Array(UInt8,128)
buffer3 = Array(UInt8,9)
io = open(FT_DeviceIndex(0),uartconfig1)
setlatencytimer(io,2); #Should speed things up a little
rtdminterface = RTDMInterface(mapdict,io);

In [16]:
rtdm_write(rtdminterface, 0x5555, :SPI1CH1_BUFFER)

In [59]:
rtdm_read(rtdminterface, UInt16, :SPI1CH1_BUFFER)


LoadError: RTDMError: malformed response (1 retries)
while loading In[59], in expression starting on line 1

 in rtdm_read at C:\Users\Chris\.julia\v0.4\MicrochipRTDM\src\RTDM.jl:178
 in rtdm_read at C:\Users\Chris\.julia\v0.4\MicrochipRTDM\src\RTDM.jl:290

In [57]:
rtdm_write(rtdminterface, 0xffff,:Flags)


LoadError: RTDMError: malformed response (1 retries)
while loading In[57], in expression starting on line 1

 in rtdm_write at C:\Users\Chris\.julia\v0.4\MicrochipRTDM\src\RTDM.jl:275
 in rtdm_write at C:\Users\Chris\.julia\v0.4\MicrochipRTDM\src\RTDM.jl:281

In [46]:
rtdm_read(rtdminterface, UInt16, :Flags)


Out[46]:
0xffff

In [49]:
buffer4 = Array(UInt8,128)
rtdm_read!(rtdminterface, buffer4, :SPI1CH1_BUFFER)
buffer4


Out[49]:
128-element Array{UInt8,1}:
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
    ⋮
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00

In [12]:
mapdict


Out[12]:
Dict{Symbol,UInt32} with 40 entries:
  :power_in             => 0x00000824
  :offsetP2             => 0x00000816
  :DTRC                 => 0x00000836
  :adc2                 => 0x00002bf8
  :DTRA                 => 0x00000832
  :RTDM_CRC             => 0x00000808
  :RTDM_BffrIdx         => 0x00000802
  :offsetP3             => 0x00000818
  :offsetP1             => 0x00000814
  :RTDM_CRClo           => 0x0000080c
  :offsetP4             => 0x0000081a
  :SPI1CH0_BUFFER       => 0x00000880
  :offsetP6             => 0x0000081e
  :RTDMFlags            => 0x0000080e
  :offsetP8             => 0x00000822
  :PWM_PERIOD           => 0x00000830
  :RTDM_UART_MODE_VALUE => 0x00000810
  :SPI1CH1_BUFFER       => 0x00000980
  :RTDM_BffrLen         => 0x00000804
  :RTDM_Poly            => 0x00000806
  :RTDM_State           => 0x00000800
  :PTR_SPI2CH0_BUFFER   => 0x00000840
  :DTRD                 => 0x00000838
  :PTR_SPI1CH0_BUFFER   => 0x0000083c
  :DTRB                 => 0x00000834
  ⋮                     => ⋮

In [ ]:


In [9]:
close(rtdminterface)

In [ ]: