Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8756113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:59:39+00:00 2026-06-13T13:59:39+00:00

I want to write a byte to register with specific memory address (0x1228A432) But,

  • 0

I want to write a byte to register with specific memory address (0x1228A432)

But, this register has a following structure:

 Bits  |   Access   |   Name   | Reset  | Description |
[31:8] | Read only  | -------- | ------ |  Reserved   |
[7:0]  | Read-write | REG[7:0] | 0xXX   | ----------- |

Please tell me, how to write a byte to this register without “touching” the Reserved bits?

EDIT1: My target is Cortex A9.
I could successfully read/write to onboard DDR2 memory using 256-bit values (such as 0xFF)

EDIT2: I used to work with DDR2 memory in the following way :

// First stage
static unsigned char *p = 0;
char * argv1="0x60000000";
unsigned long address=strtoul(argv1, 0, 0);
p = (unsigned char *) argv1;

// Second stage
char * argv4="FF";
int value=strtol(argv4,0,16);

// Third stage
int offset = 9;
p[offset]=value;

EDIT3: I found out the following information:

All registers are 32 bits wide and do not support byte writes.
Write operations must be word-wide and bits marked as reserved must be preserved
using read-modify-write.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:59:40+00:00Added an answer on June 13, 2026 at 1:59 pm

    One way to preserve bits [31:8], assuming 32-bit wide access, is to read the value, zero-out bits [7:0], bitwise-or it with the value needed and then write it back to the register.

    Something like (stealing from RedX a bit 😉 ):

    uint8_t your_8_bit_value = 0x42;
    uint32_t volatile * const mem_map_register = (uint32_t volatile *) 0x1228a432;
    *mem_map_register = (*mem_map_register & 0xFFFFFF00) | your_8_bit_value;
    

    Yet I think there should be more info available about your hardware. I’ve seen several datasheets saying e.g. that you have to write all 1 to reserved bits (meaning that reserved bits are reserved for future use, and 1 is a safe default), etc. So it is not always obvious, that leaving reserved bits untouched is the right thing to do.

    You should find more details about your hardware – are byte-wide writes supported, are writes to reserved bits ignored perhaps, or should be all 0/1, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is perhaps similar to previous posts, but I want to be specific about
I want to write a byte[] data to a file and I found this
I want to write a byte array to file. This is code in the
I want to write a batch script statement where: FINDSTR has to check for
I want to write a procedure to perform a delete for the following i
I want write a small program to get IP Address of some websites by
I want to write an object into a stream (or byte array) with its
I have some xml encoded as UTF-8 and I want to write this to
I have an byte array buffer of max size 1K. I want to write
I want to write the integer 1 into the first byte and 0x35 to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.