{"action":"opened","issue":{"url":"https://api.github.com/repos/doceme/py-spidev/issues/28","labels_url":"https://api.github.com/repos/doceme/py-spidev/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/doceme/py-spidev/issues/28/comments","events_url":"https://api.github.com/repos/doceme/py-spidev/issues/28/events","html_url":"https://github.com/doceme/py-spidev/issues/28","id":97788708,"number":28,"title":"All xfer2()s on MCP3008 return \"TypeError: Argument must be a list of at least one, but not more than 4096 integers\"","user":{"login":"timwood0","id":3924059,"avatar_url":"https://avatars.githubusercontent.com/u/3924059?v=3","gravatar_id":"","url":"https://api.github.com/users/timwood0","html_url":"https://github.com/timwood0","followers_url":"https://api.github.com/users/timwood0/followers","following_url":"https://api.github.com/users/timwood0/following{/other_user}","gists_url":"https://api.github.com/users/timwood0/gists{/gist_id}","starred_url":"https://api.github.com/users/timwood0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timwood0/subscriptions","organizations_url":"https://api.github.com/users/timwood0/orgs","repos_url":"https://api.github.com/users/timwood0/repos","events_url":"https://api.github.com/users/timwood0/events{/privacy}","received_events_url":"https://api.github.com/users/timwood0/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-28T19:56:29Z","updated_at":"2015-07-28T19:56:29Z","closed_at":null,"body":"I have followed numerous guides (that all agree) to wire up the MCP3008.  I breadboarded a simple pot sensing circuit.  The spidev/spi_bcm{2708,2835} drivers are installed and I tested MISO/MOSI with a direct test.  But I always get this message.  \r\nTraceback (most recent call last):\r\n  File \"adafruit_mcp3008-spi.py\", line 56, in <module>\r\n    trim_pot = readadc(potentiometer_adc)\r\n  File \"adafruit_mcp3008-spi.py\", line 36, in readadc\r\n    r = spi.xfer2(commandout)\r\nTypeError: Argument must ...\r\n\r\nThe skinny on the affected code (ported from Adafruit bit-banging to use py-spidev):\r\ndef readadc(adcnum):\r\n\tif ((adcnum > 7) or (adcnum < 0)):\r\n\t\treturn -1\r\n\tcommandout = [ 0, 0, 0 ]\r\n\tcommandout[0] = 0x1 # start-bit\r\n\tcommandout[1] = (0x8 | adcnum) << 4 # single-ended bit | A-channel#\r\n\tcommandout[2] = 0   # we only need to send 5 bits here\r\n\r\n\t# Take in result as array of three bytes. \r\n\t# Return the two lowest bits of the 2nd byte and\r\n\t# all of the third byte; use default speed, bits/word, delay\r\n\tr = spi.xfer2(commandout) <-- ERROR\r\n\r\n\t# read in 10 ADC bits\r\n\tadcout = ((r[1] & 3) << 8) | r[2]\r\n\treturn adcout\r\n\r\nBTW spidev_module.c confusingly uses the same error message for several different error cases.\r\n\r\nAnyone see anything obviously wrong here?  I tried running with tomstokes/python-spi library; the test senses bursts of noise values on the A/D output with that stack."}}