Keil Logo

C166: Bytes in RAM Appear Twice


Information in this article applies to:

  • C166 All Versions

QUESTION

I write the string "TESTSTRING" into an array in external RAM. When I send this string to the serial interface it is transmitted as "TTSSSSRRNN". The characters are doubled and every second character is missing. What's wrong?

ANSWER

The RAM of your board can only be accessed as a word (16 bit) and not as a byte (8 bit). There are two possible reasons for this problem:

  • Only the 'Write Enable' (WR) signal and not the 'Byte High Enable' (BHE) signal of the microcontroller is used to address the RAM. In order to access single bytes with a 16 bit data bus, two 'Write Enable' signals are necessary. One for the high byte and one for the low byte.
  • The 'Write Enable' (WR) pin and the 'Byte High Enable' (BHE) pin of the microcontroller can be configured to emit a 'Write Enable Low' (WRL) and 'Write Enable High' (WRH) signal. The 'Write Configuration Control Bit' (WRCFG = SYSCON.7) selects the function of these two pins. Set the value of WRCFG according to your hardware configuration in the startup code (START167.A66) of your application.

    $SET (WRCFG_ENABLE = 1) ; 0 = WRCFG is set according to the level at
    ;                       ;     pin P0H.0 during reset.
    ;                       ; 1 = the following _WRCFG value is
    ;                       ;     written to WRCFG in the SYSCON register
    ; WRCFG: Write Configuration Control Bit (SYSCON.7):
    _WRCFG   EQU    1       ; 0 = Normal configuration of WR# and BHE#
    ;                       ; 1 = WR# pin acts as WRL#, BHE# pin acts as WRH#
    

MORE INFORMATION

  • Refer to the External Bus Interface chapter of your Microcontroller User's Guide.
  • Refer to START167.A66 in the C166 User's Guide.

SEE ALSO


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.