m12lrpv 0 Posted May 26, 2016 Share Posted May 26, 2016 Hi, I'm trying to use an old stellaris launchpad board as a datalogger to an SD card for logging data from an accelerometer. I've already built such a project on the arduino hardware but best I can do is one reading per 2ms and I want to get it logging faster... at least 1 reading every 500us. So I thought I would port it onto the the launchpad boards I had kicking around. Straight up the SD card didn't work trying to use SPI(3) as the underlying SPI bus and I have downloaded and tried about 6 different sd card libraries but got nowhere. What I then did was go back to first principles. Confirm SPI is working on the default SPI bus SPI(2) before switching to SPI3 and before putting the SD libraries on top of it. So I grabbed the simplest SPI product I had, a microchip MCP4251 digital pot and wired it up on a breadboard and confirmed it fully working at 5v with the arduino. The MCP4251 is specced for 3.3v @10Mhz so presumably there should be no issue using it with the launchpad. When I wired it to the launchpad it didn't work. It sort of worked for one of the digital pot's channels but not for the other. It's sort of stuck on power up settings but the behaviour is not logical so I cannot diagnose a problem. I tried the clock divider to slow it down a bit to check if that was the case but to no effect. I tried setting the SPI modes to 0 and 1 as per the pots datasheet and I tried manually pulling down the CS earlier but it seems that the SPI library does something that disables access to the CS pin. Checking and comparing the signals at the chip with a scope they all "appear" correct but I only have a 2 channel scope and no logic analyser so I cannot check it with enough detail to confirm. I can bit bang it but want to do it in hardware. I swapped the pot for 2 others I have and they all perform (or don't perform) exactly the same. There's some sonsistency there at least. At this stage i'm left with wondering if there's an issue with the energia SPI library. Not something I would have expected to be the case as SPI is pretty basic functionality but you never know. Alternatively it's possibly an issue with using the library. Unfortunately there are no examples of SPI usage which are relevant as they all use the msp430. If anyone has an example that they can confirm working against a Microchip product It would be much appreciated. I'm using energia given i'm trying to port arduino code but happy to use CCS which i've used for other projects. I'm at work and don't have the code with me which is why I havent posted code. Regards, David Quote Link to post Share on other sites
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.