Comments (13)
How exactly it does not work? How it was tested? This code is directly from the starter project that works.
Build the original starter project and check that it works on your hardware.
from usb-sniffer-lite.
I've done exactly that, and it doesn't work! I'm receiving garbage
static void uart_init(uint32_t baud)
{
RESETS_CLR->RESET = RESETS_RESET_uart0_Msk;
while (0 == RESETS->RESET_DONE_b.uart0);
baud = (F_PER * 4) / baud;
UART0->UARTIBRD = baud / 64;
UART0->UARTFBRD = baud % 64;
UART0->UARTLCR_H = (3/*8 bits*/ << UART0_UARTLCR_H_WLEN_Pos) | UART0_UARTLCR_H_FEN_Msk;
UART0->UARTCR = UART0_UARTCR_UARTEN_Msk | UART0_UARTCR_RXE_Msk | UART0_UARTCR_TXE_Msk;
HAL_GPIO_UART_TX_init();
HAL_GPIO_UART_RX_init();
}
//-----------------------------------------------------------------------------
int main(void)
{
sys_init();
timer_init();
...
uart_init(115200);
uart_puts("\r\nHello, world!\r\n");
PI PICO + debug probe (for PI PICO), recv data:
00 43 21 fffd 16 fffd fffd fffd 09 fffd 271 fffd fffd 35
29 fffd
from usb-sniffer-lite.
Oh what hardware and with what device used as a receiver?
from usb-sniffer-lite.
PI PICO + debug probe (for PI PICO), recv data:
00 43 21 fffd 16 fffd fffd fffd 09 fffd 271 fffd fffd 35
29 fffd
from usb-sniffer-lite.
from usb-sniffer-lite.
@ataradov Does this code work for you?
from usb-sniffer-lite.
I can see junk being received by the Pico debug probe. It works fine with other adapters.
It also works fine after the initial Hello World string. If you type characters, it will echo them back correctly.
I assume this is some bug in the pico probe. It may not like initial level transitions when device is reset or something like this.
Try with a different USB to UART adapter.
from usb-sniffer-lite.
oh, right!
sleeping a little.. and it works:
uart_init(115200);
for (uint32_t a = 0; a < 1000000; a++) {b++;};
uart_puts("\r\nHello, world!\r\n");
uart_puts("\r\nHello, world!\r\n");
from usb-sniffer-lite.
Yes, I was just going to suggest that. There is a chance that clock is not entirely stable at that point, but given that it works with a number of other adapters, but not with Pico Probe, I would assume this is some issue with the probe.
I don't have time to investigate that right now.
from usb-sniffer-lite.
Thank you very much for the help. How can I implement a sleep function for X milliseconds in your baremetal environment?
from usb-sniffer-lite.
The same way as on any other MCU:
static void delay_ms(int ms)
{
uint32_t cycles = ms * F_CPU / 3 / 1000;
asm volatile (
"1: sub %[cycles], %[cycles], #1 \n"
" bne 1b \n"
: [cycles] "+r"(cycles)
);
}
Normally you would want this to be located in the RAM through the section attribute, but in this case it already runs from the RAM.
from usb-sniffer-lite.
Great! Is there a way to generate the ELF file to debug it? I think there might be something wrong with the checksums or something. The U2F with your tool works great, but I'd like to use OpenOCD for debugging and a I need a valid ELF (the generated ELF with Makefile dont works)
from usb-sniffer-lite.
You can get the CRC value generated by the tool and place it in the linker script instead of a dummy value LONG(0xcccccccc).
The value would be different for different compilers, but you can get it by running
bin2uf2 -s -i UsbSnifferLite.bin -o UsbSnifferLite.bin
It will show you the correct CRC. In my case it is 0x76b0d78e. So you would replace LONG(0xcccccccc) with LONG(0x76b0d78e).
from usb-sniffer-lite.
Related Issues (14)
- HOW is boot crc converted from 0xcccccccc to something the boot ROM accepts? HOT 2
- Linker error HOT 7
- When I connect both the D+ and D- wires to the board, the connection between the testing Cool Disk with the computer is lost! HOT 9
- Nice, it would be interesting to add other protocols - Alternative for the Saleae Logic Analyzer HOT 1
- Synchronization issue HOT 4
- Pokken Tournament DX Controller Spewing Errors HOT 2
- Here is an udev rule HOT 1
- Does not function yet HOT 14
- development environment HOT 3
- BIN2UF2 PROBLEM HOT 2
- A QUESTION ABOUT C CODE HOT 1
- Error issue HOT 1
- other rp2040 libraries HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from usb-sniffer-lite.