LPC2290/2/4 - Access to a data 16 bits of a peripheral on bus 8 bits.
2005-10-27 by noelbouverat
I carried out wiring a µP LPC2294 and a SPC3 Profibus Device, such as
indicating p60 instruction manual of May 3, 2004, on the CS3.
The writing of a word of 16 bit occurs correctly (correct management
of signal BLS[0 ]). The reading of a byte also proceeds very well.
On the other hand the reading of a word of 16 bits returns the value
of the weak byte of weight for the 2 addresses implied.
Does somebody have an answer?
...
...
#define INIT_BCFG(mw_2, wst2_5, rble_1, wst1_5, idcy_4) ( \
(((mw_2) & 0x03) << 28) | (((wst2_5) & 0x1f) << 11) | \
(((rble_1) & 0x01) << 10) | (((wst1_5) & 0x1f) << 5) | \
((idcy_4) & 0x0f))
#define BASE_REG_SPC3 0x83000000
#define R_USER_WD_VALUE_SPC3 (volatile WORD *)(BASE_REG_SPC3 + 0x18)
...
BCFG3 = INIT_BCFG(0, 5, 0, 4, 0);
PINSEL2 = 0x0E6049E4 | 0x10000 | 0x800000 | 0x1000000;
...
volatile WORD lWord;
volatile BYTE lByteL, lByteU;
...
lWordW = TEST_WORD;
*(R_USER_WD_VALUE_SPC3) = lWordW; ==> write OK
lByte = *((BYTE *)(BASE_REG_SPC3 + 0x18)); ==> read OK
lByteR = *((BYTE *)(BASE_REG_SPC3 + 0x19)); ==> read OK
lWordR = *(R_USER_WD_VALUE_SPC3); ==> read KO