Blackfin BF533 SPI debugging log

Source: Internet
Author: User

Address: http://www.cnblogs.com/yanhc/archive/2008/08/22/2175269.html

 

I recently participated in the adi udc (University Design Competition) competition to debug the touch screen. I used BF533. After debugging the SPI for half a day, I asked Yiqi, But I replied with a barrier, later I asked about the DSP technical support of Adi in China. They also debugged myCode, Really responsible, it turns out that I didn't add ssync (); this statement.
However, there is still a problem with the touch screen, and BF533 cannot communicate with it currently.

 

 

// ** File: SPI. h
// ** Target: ADSP-BF533
// ** Creat time:
# Ifndef _ spi_h
# DEFINE _ spi_h

# Define spi_sel_low * pspi_flg & = ~ 0x2000 // spisel5 CLR
# Define spi_sel_high * pspi_flg | = 0x2000 // spisel5 set

// SPI interface funtion
Void spi_init (void );

// SPI send a word Function
Void spi_send_data (unsigned short data );

// SPI receive a word Function
Unsigned short spi_receive_data (void );

# Endif

// ** File: SPI. c
// ** Target: ADSP-BF533
// ** Creat time:
# Include <ccblkfn. h>
# Include <cdefbf533.h>
# Include "sys_func.h"

// SPI interface funtion
Void spi_init (void)
{
* Pspi_baud = (unsigned short) (getsclk ()/(2x10000000); // 5 MHz
// SPI enable, master mode, cpha = 1 (control by software ),
// 16 bit, start transfer with write of spi_tdbr
* Pspi_ctl = 0x5501;
* Pspi_flg = 0xff20; // spisel5 Enabled
}

// SPI send a word Function
Void spi_send_data (unsigned short data)
{
* Pspi_tdbr = data;
While (* pspi_stat & 0x0001) = 0 );
}

// SPI receive a word Function
Unsigned short spi_receive_data (void)
{
Spi_send_data (0 xFFFF );
Return (* pspi_rdbr );
}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.