#58575 - josath - Mon Oct 24, 2005 6:18 pm
I'm trying to turn off a backlight. But for some reason, both backlights, and the sound amp turn off when I do this. The only part I'm not sure about is 3, what is the 'register offset'?
From neimod's DSTek:
My code (numbers indicate which step it corresponds to):
FYI: SPI_8CLOCKS and SPI_SINGLE_BYTE are defined to 0, I just added them to be clear what I am doing.
Any suggestions where I went wrong? What exactly is "register offset"? My guess, is it means the 0 in the line "PM 0H - REG_PM_CONTROL - Powermanagement Control (Register 0h) (R/W)" which is why I'm currently setting it to 0.
From neimod's DSTek:
Quote: |
Reading and writing powermanagement registers 1. Wait until the SPI busy flag is cleared 2. Enable SPICNT, with baudrate 1MHz, powermanagement device, 8 clocks, and continuous mode. 3. Set SPIDATA to the register offset a)To read from the PM register, enable bit 7. b)To write to the PM register, clear bit 7. 4. Wait until the SPI busy flag is cleared 5. Set SPICNT to single byte mode now 6. a)Set SPIDATA to 0 b)Set SPIDATA to the register value you want to write. 7. a)Wait until the SPI busy flag is cleared 8. a)the lower 8bits of SPIDATA now contain the contents of the PM register. |
My code (numbers indicate which step it corresponds to):
Code: |
SerialWaitBusy(); //1 REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz | SPI_DEVICE_POWER | SPI_8CLOCKS | SPI_CONTINUOUS; //2 REG_SPIDATA = 0; //3 - is this right? SerialWaitBusy(); //4 REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz | SPI_DEVICE_POWER | SPI_8CLOCKS | SPI_SINGLE_BYTE; //5 REG_SPIDATA = 0; //6a // This line should keep everything on, execpt for the bottom backlight. However, both backlights, and the sound amp turn off REG_SPIDATA = PM_SOUND_PWR | PM_SOUND_VOL | PM_BACKLIGHT_TOP | PM_LED_CONTROL(0) | PM_SYSTEM_PWR; //6b SerialWaitBusy(); //7 |
FYI: SPI_8CLOCKS and SPI_SINGLE_BYTE are defined to 0, I just added them to be clear what I am doing.
Any suggestions where I went wrong? What exactly is "register offset"? My guess, is it means the 0 in the line "PM 0H - REG_PM_CONTROL - Powermanagement Control (Register 0h) (R/W)" which is why I'm currently setting it to 0.