hi... folks
i am using nrf53832 , i want to merge the uart and timer . i tried my level best but timer is not working
help me
thanks in advance
hi... folks
i am using nrf53832 , i want to merge the uart and timer . i tried my level best but timer is not working
help me
thanks in advance
Hi,
Can you elaborate on what you have done / how you have done it, and how it is not working? Have you done any debugging to see what is going on?
yeah , i merged the timer example program with uart . but i couldn't find , my timer is not running
It seems you have copied the timer code from the SDK timer example, but you have forgotten to start it (you are not using your calculated time_ticks variable for anything). Referring to the example and assuming that is what you want to do, you are missing the call to nrf_drv_timer_extended_compare(). Your timer code should probably be something similar to this:
//Configure TIMER_SENSOR for generating simple light effect - leds on board will invert his state one after the other.
nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
err_code = nrf_drv_timer_init(&TIMER_SENSOR, &timer_cfg, timer_sensor_event_handler);
APP_ERROR_CHECK(err_code);
time_ticks = nrf_drv_timer_ms_to_ticks(&TIMER_SENSOR, time_ms);
nrf_drv_timer_extended_compare(
&TIMER_SENSOR, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);i didn't get you... can you say me clearly
(you are not using your calculated time_ticks variable for anything).??
In the code you posted you calculate the time_ticks like this:
time_ticks = nrf_drv_timer_ms_to_ticks(&TIMER_SENSOR, time_ms);
but you never actually use it. There is no wonder your timer is not running. Please compare with the timer example or the code snippet I pasted in my previous answer where you see the line you are missing (assuming this is what you want to do).
how to compare ,actually here i want to check the data see the code
void timer_sensor_event_handler(void)
{
uint32_t threshold = 32;
char str[80];
uint32_t length1;
char pavi;
char event;
switch (event)
{
if(m_sample < threshold)
{
length1 = sprintf(str,"%d", m_sample);
ble_nus_data_send(&m_nus,str,sizeof(m_sample), m_conn_handle);
ret_code_t err_code = nrf_drv_twi_rx(&m_twi, 0x48U, &m_sample, sizeof(m_sample));
NRF_LOG_INFO("SUCCESS1");
}
break;
default:
//Do nothing.
break;
}
}I do not follow see how this code relates to what we have been discussing earlier in this thread?
I do not follow see how this code relates to what we have been discussing earlier in this thread?