Hello,
in use is the nrf connect sdk v2.6.2 toolchain v2.6.2 on my nrf5340DK
I struggle transmitting ADC data from my nrf5340DK via USB to my windows PC. On my PC there is some .py chart script or windows form app WFA. These two programs are tested with some older project on an esp8266. On this esp MCU I simple
void task_printOutFast(void) { if (nonBlockingBoolean_1) { nonBlockingBoolean_1 = false; Serial.printf("%.2f\n", current_mA_prim); //current_mA_prim = } }
every 2-5 ms, and the response on my PC visualisation is kinda real time.
Unfortunately I dont accomplish this with the nrf MCU
So any help is very much appreciated
On my nrf MCU the SAADC software and hardware events are well evaluated through gpio toggle and oszi measurement. Althoug I couldnt slow down the advanced non-blocking internal timer , the internal timer I did some workaround and only used every 32th sample to evaluate with slower speed. Anyway, the
void test_work_handler(struct k_work *work) { struct usb_work_item *item = CONTAINER_OF(work, struct usb_work_item, work); static char bulk_buffer[8192]; // Large enough for multiple samples int bulk_index = 0; // Serialize all ADC data into the bulk buffer for (uint16_t i = 0; i < item->size; i++) { bulk_index += snprintf(&bulk_buffer[bulk_index], sizeof(bulk_buffer) - bulk_index, "%u\n", item->data[i]); if (bulk_index >= sizeof(bulk_buffer) - 8) { // Ensure we don't overflow the buffer break; } } // Send the bulk buffer via UART uart_fifo_fill(dev, bulk_buffer, bulk_index); // Toggle GPIO to indicate completion nrfx_gpiote_out_task_trigger(&gpiote_inst, GPIO_TO_TOGGLE); }
[00:22:44.568,511] <wrn> usb_cdc_acm: Ring buffer full, drop 64 bytes
or explain why its so strait forward when using cheap esp MCU compared to great nrf device?