• AVR Freaks

MCP2210 Breakout module crashes on SPI transfer

Author
pavanbabut
New Member
  • Total Posts : 7
  • Reward points : 0
  • Joined: 2012/09/12 14:34:55
  • Location: 0
  • Status: offline
2012/09/12 14:48:37 (permalink)
0

MCP2210 Breakout module crashes on SPI transfer

Hello all,
I bought a MCP2210 breakout module to potentially use it in our application. I wrote a simple managed C++ program using MCP2210DLL-M dll. I was able to create an instance and set all GPIO and SPI settings (I even checked them using Get functions to make sure they have been updated after I programmed them), but when I send data using 'TxferSpiData', the application hangs and stops responding.
 
Here are the sequence of commands I used:-
UsbSpi = gcnewDevIO(0x4D8, 0x00DE);
isConnected = UsbSpi->Settings->GetConnectionStatus();
String^ serial = UsbSpi->Settings->GetSerialNumber();
UsbSpi->Settings->SetPwrConfig(0, false);
UsbSpi->Settings->SetReqdCurrentLd(500);
out = gcnew array<unsigned char>(2) {0x00,0x00};
in = gcnew array<unsigned char>(2) {0x00, 0x00};
gpPinDes = gcnew array<unsigned char>(9) { 0,0,0,0,0,0,0,0,1 };
UsbSpi->Settings->SetAllChipSettings(0, gpPinDes, 0 , 0, false, 0, 0);
UsbSpi->Settings->SetAllSpiSettings(0, 10000, 1, 0, 0, 0, 0, 2, 1 );
out[0] = 0x18;
out[1] = 0x02;
intret = UsbSpi->Functions->TxferSpiData(out, in); <--- Program hangs at this statement

Any help is greatly appreciated.
thanks
 
 
 


#1

5 Replies Related Threads

    pavanbabut
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2012/09/12 14:34:55
    • Location: 0
    • Status: offline
    Re:MCP2210 Breakout module crashes on SPI transfer 2012/09/14 10:47:03 (permalink)
    0
    155 views and no replies, come on, isn't there someone who is using this breakout module?
     
    thanks
    #2
    farrelldj
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2012/09/20 08:35:51
    • Location: 0
    • Status: offline
    Re:MCP2210 Breakout module crashes on SPI transfer 2012/09/20 08:49:52 (permalink)
    0
    Yes. I notice the same crashing and error behavior when using the SPI Terminal v1.0 program from the MicroChip website.
    I also sometimes see another error- TxFerSpiData error setting SPI parameters.
    The status shows it is detected and connected and these problems continue to occur when the module is unplugged from my target board.  I can sometimes eliminated the problem by unplugging the USB cable and plugging it back in (which also removes its power).
    I was planning to use this module to exersize and debug an SPI target interface but I did not expect the need to debug the module or its software.
    If anyone happens to revise the code, please add the option to reverse the bit order, i.e. LSb or MSb first.
     
    #3
    tstelmaszek
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2012/07/06 17:33:27
    • Location: 0
    • Status: offline
    Re:MCP2210 Breakout module crashes on SPI transfer 2012/09/22 16:10:12 (permalink)
    0
    I've run into a similar issue when using the managed dll and an application running in C#.  Whether I run full speed or step through the program it gets to the TxFerSpiData and just stays there, no error messages, no timeouts nothing.  I have been able to communicate with the 2210 and read discrete inputs and drive LED outputs.  I can set SPI communications parameters and read them back for verification.  The problem comes when I try to communicate with the IO expander chip.  Everything works when I use the MCP supplied utilities which are written in VB and translated sections of them into C#.  I can't see what's different.  I tried different bit rates, buffer sizes, transfer lengths and data sent, all with the same result.  Does anyone know if the source code for the dll is available somewhere?
    #4
    farrelldj
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2012/09/20 08:35:51
    • Location: 0
    • Status: offline
    Re:MCP2210 Breakout module crashes on SPI transfer 2012/09/25 15:12:56 (permalink)
    0
    I have not found the DLL source code. I hope this helps- After some experimentation I have found that the problems are significantly reduced if I
    1. close the terminal program,
    2. unplug the USB, plug USB back in, (which powers down and up the unit along with rst)
    3. start the terminal program, and use a bit rate of 1000000. 
    Previously, I was using a lower bit rate. This implies there may be a minimum bit rate.  I see the types of errors differ depending upon the sck rate. Once an error occurs I have poor luck recovering without a power down. I don't see any documentation to explain why. Does anyone from MicroChip monitor this forum? I'll look for a more direct way to get support from MicroChip.
     
     
    post edited by farrelldj - 2012/09/25 15:38:05
    #5
    mkm
    New Member
    • Total Posts : 16
    • Reward points : 0
    • Joined: 2011/03/07 03:13:01
    • Location: 0
    • Status: offline
    Re:MCP2210 Breakout module crashes on SPI transfer 2012/09/26 14:56:14 (permalink)
    0
    Hi,
    I am seeing a similar thing. I tried with the SPI Terminal and I can see problems when using bit rates of less than 100,000 in SPI modes 1 and 3.
    SPI modes 0 and 2 seem to work fine. I transferred just fine the example bytes for MCP23S08 using the lowest bit-rate of 1464 (at least this is what I got after I put 1 bps into the speed value) . This was in SPI mode 0. The app hangs and I have to unplug/plug back the board when trying the same rates (lower than 100,000bps) but in SPI modes 1 and 3.
    #6
    Jump to:
    © 2020 APG vNext Commercial Version 4.5