Hello, I'm using Keil MCBSTM32 evaluation board and µVision3. I use the example CAN program downloaded from keil. My application will be to use an external rotational transducer (instead of the potentiometer on the board) to send converted analog value in CAN message. Which code should i change/add so that i could use the transducer (at port A chan 0 for example) instead PA ch 1 of the pot? I've read the reference manual from ST but i didn't see any indication telling which registers correspond to which channel to use. Thank you in advance.
In STM32's control register they're ADC_CR1 et ADC_CR2:
In CanDemo.c:
ADC1->CR1 = 0x00000100; // use independant mode, SCAN mode
ADC1->CR2 = 0x000E0003; // data align right, cont conversion
In ADC_CR1 however there's AWDCH[4:0]: Analog watchdog channel select bits. Is that it? i dont wanna use watchdog though.
Thanx!
I don't know. I am not familiar with your processor, but the data sheet is. it must be there!
Thanx for ur reply, i think i figured it out how to get my sensor to work in PA CH0. Anyway, is there anyway easy to generate an error? my application would be quite simple: i want to demonstrate a CAN communication - interfacing the sensor to stm32 and get to see the communication (the frames) preferably at my PC. the µVision3 simulation able to do that? or do i need to use a CAN Analyser like for example ValueCAN (intrepidcs.com/.../35) for that purpose?
as far as I know, you would require a CAN sniffer of some kind.
maybe this helps: http://www.keil.com/download/docs/373.asp