User Manual
Version 1.1
2011-07-15
deRFnode and deRFgateway
dresden elektronik
ingenieurtechnik gmbh
Enno-Heidebroek-Str. 12
12 7 Dr
n
rm  n
Tel.: +49 351 31 85 00
Fax: +49 351 3 18 50 10
wireless@dresden-elektronik.de
www. r
n- l k r nik.
Page 48 of 56
If you like to access the external flash with an AVR MCU, a code snippet suitable for reading
the manufacturer and device IDs (see AT25DF041 datasheet, chapter 10) is:
uint8_t i, data[4];
/* Set MOSI, SCK and CS output, all others input */
DDRB = (1<
DDRE = (1<
/* Enable the SPI interface, make the MCU SPI master */
SPCR = (1<
/* Select the serial clock SCK to be (FOSC/4) and double it
* (i.e. if CPU runs at 8MHz, SPI clock will be 4MHz)
*/
SPCR &= ~((1<
SPSR = (1<
/* Start SPI transaction by setting CS low */
PORTE &= ~(1<
/* Send the command byte (Read Manufacturer and Device ID) */
SPDR = 0x9F;
/* wait for termination */
while (!(SPSR & (1 << SPIF))) ;
for(i=0; i<4; i++)
{
/* Do dummy write for initiating SPI read */
SPDR = SPI_DUMMY_VALUE;
/* wait for termination */
while (!(SPSR & (1 << SPIF))) ;
/* Upload the received byte in the user provided location */
data[i] = SPDR;
}
/* Stop the SPI transaction by setting CS high */
PORTE |= (1<
/* check the read Ids (must be 0x1F,0x44,0x01,0x00) ... */
As like as in all previous chapters, a ready-to-use library is provided on the CD-ROM belong-
ing to the deRFdevelopment Kit.
9.4.6. Initialize and use the Ethernet transceiver
Only the deRFgateway boards are equipped with Ethernet circuitry hardware (PHY layer
transceiver). The EMAC must be implemented in software. Although it is not impossible to do
this with an AVR, we focus on using it with an ARM MCU here since as like as in all chapters
before the AT91Lib includes even this part.
Transceiver and MCU are connected via RMII (Reduced Media Independent Interface). To
save energy the Ethernet transceiver starts up in power-down mode (pull-down resistor on
主站蜘蛛池模板:
友谊县|
红原县|
云安县|
南雄市|
沁源县|
加查县|
潮安县|
永仁县|
睢宁县|
桦南县|
合作市|
陆丰市|
赤峰市|
余干县|
汽车|
莱阳市|
台东县|
荥经县|
内丘县|
禹州市|
巴楚县|
忻州市|
丹江口市|
奇台县|
二手房|
乐清市|
新化县|
聂拉木县|
金乡县|
罗城|
高雄县|
台南县|
巫溪县|
昭觉县|
保靖县|
安吉县|
清涧县|
禹城市|
孝昌县|
广灵县|
天祝|