How to program (AT91sam7s64) to SPI MISO, MOSI, SCLK mode?

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

First of all I'm glad to be here.

 

I'm newbie here and on microcontrollers too.

Well, I have an old V8 Jlink, and my project is to use SPI output to read an SD card with 1bit only.

I have good skills in electronics and soldering, but few experiences in programming. 

Is it possible to implement or convert this "black brick" in my project?

Board Microcontroller is AT91SAM7S64

 

I'd like to use SPI output:
MISO

MOSI

SCLK

nReset (if Possible)

Here is log from V8 and pic:

 

Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
Hardware version: V8.00
S/N: 12131121
License(s): RDI,FlashDL,FlashBP,JFlash,GDBFull
VTref=3.313V

  J) JTAG (Default)
  S) SWD
  T) cJTAG

 

 

 

 

 

 

Attachment(s): 

Last Edited: Sat. Apr 4, 2020 - 10:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Unfortunately, the sam7s series is obsolete, so finding tools for it might be a challenge. I’d suggest you’d be better off getting something more modern and with Arduino support.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I found this code from Olimex: Do you think can work?

 

 

// This program shows how to work whit SPI interface and
// connected to it multimedia card
// Programs read/write buffer to MMC card

#include "AT91SAM7S64.h"
#include "system.h"
#include "mmc.h"
#include "string.h"

//MAIN POINTER
AT91PS_PIO    m_pPio   = AT91C_BASE_PIOA;

//it's a simple delay
void Delay (unsigned long a) { while (--a!=0); }

// external buffer which is use to read/write in MMC card
extern char mmc_buffer[512];

int main()
{
  /**** System init ****/
  InitFrec();
  Init_CP_WP();

  //chek for CP and WP
  //CP - card present
  while(((m_pPio->PIO_PDSR) & BIT15)) { /*put your card present event here*/  }
  //WP - write protect
  while(((m_pPio->PIO_PDSR) & BIT16)) { /*put your write protect event here*/ }

  /**** MMC CARD ****/
  if (initMMC() == MMC_SUCCESS)    // card found
  {
    //card_state |= 1;
    memset(&mmc_buffer,0,512);
    mmcReadRegister (10, 16);
    mmc_buffer[7]=0;

    // Fill first Block (0) with 'A'
    memset(&mmc_buffer,'0',512);    //set breakpoint and trace mmc_buffer contents
    mmcWriteBlock(0);
    // Fill second Block (1)-AbsAddr 512 with 'B'
    memset(&mmc_buffer,'1',512);
    mmcWriteBlock(512);

    // Read first Block back to buffer
    memset(&mmc_buffer,0x00,512);
    mmcReadBlock(0,512);

    // Read first Block back to buffer
    memset(&mmc_buffer,0x00,512);
    mmcReadBlock(512,512);
  }

  while(1)
  {

  }
}