-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement button #4
Comments
I tried to register a GPIO pin (in this case P18, which I know works for output) to send interrupts on click, unfortunately I was not successful here. Have you managed to trigger any kind of interrupts from button clicks? |
I did not get to this yet, my time is a bit limited at the moment. I was planning to do this after getting your amazing Zigbee work implemented, so I can trigger a 802.15.4 packet by pressing a button. |
I was able to catch the interrupts from the button press now, it's P15 and the important thing is to pull the button gpio down since it's connecting to the positive input on the other side. I couldn't get it to work before I'm running against the 16K memory limit of the FLASH section of the hex. I tried to increase it, but then my program fails in mysterious ways (as was the case with this GPIO issue). I'm not sure what I need to change, if I move the start I get hard faults at random places, and if I change the size my program sometimes fails to boot if I make minor changes, which to me suggests something is being overwritten. That said, I have a device based on the ST17H66 now that connects to zigbee2mqtt and I can use to turn on/off a light which I've connected to a LED driver at the GPIO output. It took quite a while to reverse-engineer the relevant parts of the zigbee protocol, I intend to clean up+share it sometime in the near future but if anyone wants to use it before they should let me know. |
@biemster if you have any insight into what could be done to increase the size of the flash section let me know. Most interesting to me would be to move the UART stuff onto a different SRAM since UART should be disabled to conserve power anyways. |
Speaking of power conservation - thanks to the amazing work of @biemster and others, the zigbee light controller mentioned earlier consumes only around 80 micro-amps of power when idle (it polls for messages at a 3s interval). |
That is awesome work @natschil! This would probably also open up the possibility to use the st17h66 as a zigbee sniffer when connecting a PC to the uart? |
Also, now I think of it, there is a XIP section that GCC is not using in the linker script. Maybe that's worth investigating? |
Yes, using the st17h66 as a zigbee sniffer should be relatively straightforward, there are two issues though: b) getting them into a format wireshark understands (pcap) |
that's an interesting point regarding SRAM0, I will definitely need to look into that. |
I really dislike having to boot windows, so if I can avoid it usually I do :D but maybe I will have to try Keil... |
Line 139 in 8b5186b
|
So do I! I run it under wine actually, is that an option for you? |
yeah running it on wine should work |
Yeah I never understood really what is going on there, I just happened to stumble upon values that worked :). In my naive interpretation, FLASH is spilling over in RAM here. The original linker script is using something different:
But I have no clue what mirror mode is, and why the jump table is in the wrong place. |
oh yeah you're right, flash is spilling over to ram here. |
Those are actually between the end of GLOBAL_CONFIG and the beginning of FLASH in the current linker script right? That's a nice find actually, that explains why the SDK code starts at the weird address of 0x1FFF1838. Maybe some patch / revision of the rtos is put there in the factory? |
I tried to move all the UART stuff into SRAM1, but as far as I can tell this doesn't play well with the current flasher script - while I don't get any errors, the chip doesn't boot into anything that does anything as far as I can tell. Anyways, giving up for now, might try again on the weekend or so. |
To be fair, I don't really understand what is going on here. After all, the flashing shouldn't directly write to SRAM{0,1,2}, but these sections are loaded from flash memory I guess on boot? At least otherwise I don't see how the program being flashed would persist accross power loss... |
I thought about this a bit more, and I think I understand the flasher a bit more now (this might be completely obvious to you already):
This is however where I start to get confused, the flash memory according to the datasheet is processed the following way: But as far as I can tell, the flasher doesn't even write anything to the first 0x2000 = 8192 bytes of flash. It just copies c0 at 0x2000 in flash, which looks like this: Now if I'd have to guess, I'd say that "00500000FFFF00000000FF1FFFFFFFFF" copies fromflash address 0x5000 to SRAM (0x1fff0000) - the number of bytes is specified in the python program below and corresponds to the jump table The next line "{SZ}0000FFFF00003818FF1FFFFFFFFF", then copies the actual program, here {SZ} is presumably some compiler-specific header size or something. |
|
Nice find! I don't remember seeing this table before, is it in the ST17h66 datasheet? |
It's in the ST17H66 EVB 开发用户手册.pdf file at https://doc.lenze.club/?filePath=%2Fpublic%2Fstore%2F17H6X%28Flash%29 (unfortunately I don't remember which directory exactly it was in, as firefox seems to forget this) |
I was looking at the st17h66_blinky example, and it seems to have a slightly different flashing script - in particular the main program isn't at 0x11005000 but at 0x11009000. Any reason for this? Very bizarrely, I'm able to move this address there to any address between 0x11005000 and (roughtly) 0x11040000 , but making this change on my larger example fails... |
I really don't understand what {SZ} is doing there, do you have any insight into what this variable is? |
The |
Somehow I got writing to XIP to work. I'm still quite surprised - at one point I gave up from frustration, did a
and I took the c1,c2,c3 version of your excellent flasher from biemster/FindMy#5 |
Awesome! great work here. I was under the impression that running from XIP is more efficient (read it somewhere), but the code has to be compatible. I did not really look into this yet, but I sure will now! |
The tags in which the chip is found usually have a button as well, it would be useful to be able to use that for example turning the tag on and off, like the original iTag firmware
The text was updated successfully, but these errors were encountered: