From: Timo F. <tim...@u-...> - 2017-10-12 12:24:39
|
Ok so I just removed the unnecessary stuff and created a minimal example: https://pastebin.com/QPE14keu Writing a 0x01 in ADC1_CR1 results on 0x00 when read out. Regards, Timo -----Original Message----- From: Timo Fuckner Sent: Donnerstag, 12. Oktober 2017 12:40 To: sdc...@li... Subject: [Sdcc-user] STM8L152C6 can not write to ADC registers Hello everyone, I am currently having trouble writing the controlling registers for the ADC on STM8L152C6 (the discovery board [1]). Reading and writing the IO data and control registers works fine, but I can't change anything in the ADC registers as it seems, as they never change their RESET state. When reading them directly after setting them and directing the output to uart, there is no change. I'm not exactly sure if this is compiler or linker related, but to the best of my knowledge I did everything according to the handbook [2]. The affected registers are: ADC1_CR1 ADC1_CR2 ADC1_CR3 ADC1_SQR1 ADC1_SQR2 ADC1_SQR3 ADC1_SQR4 You can find my sourcecode here [3], SDCC version is 3.6, Win7. The sdcc command is "sdcc -mstm8 --std-c99 usart.c". For flashing I am using ST Visual Programmer 3.4.0. I hope this is actually a bug in the compiler or linker and not a user error, so I won't waste your time. Regards, Timo [1] http://www.st.com/stm8l-discovery [2] http://www.st.com/content/ccc/resource/technical/document/reference_manual/2e/3b/8c/8f/60/af/4b/2c/CD00218714.pdf/files/CD00218714.pdf/jcr:content/translations/en.CD00218714.pdf [3] https://pastebin.com/sRSPSG58 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Sdcc-user mailing list Sdc...@li... https://lists.sourceforge.net/lists/listinfo/sdcc-user |