Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - nspiredev500

Pages: [1]
1
Calculator C / reading the battery voltage
« on: February 22, 2020, 03:54:45 pm »
I want to show the battery charge to the user while my program is running, so I have to read it myself.
To test it I made a small program that reads the voltages and shows them, but it only works in firebird, not on my CX CAS HW-AA.
In firebird it shows:
VBATT: 6.0
VSYS: 6.0
B12: 3.0

on my calculator:
VBATT: 0.0
VSYS: 4.0
B12: 0.0

Is my program or my calculator broken?
Or is only VSYS used in real calculators?

Thanks in advance if anyone knows more, I haven't found anything about this.

Here is the hackspire entry for the ADC:
https://hackspire.org/index.php?title=Memory-mapped_I/O_ports_on_CX#C4000000_-_Analog-to-Digital_Converter_.28ADC.29

EDIT:
At 50% my calculator now shows 3V for VSYS, so it really seems only VSYS is used.
Would still be nice if someone could confirm this.

2
Calculator C / USB driver / HIDn recompilation problems
« on: September 16, 2019, 02:35:10 pm »
I'm trying to make a usb driver and started by looking at the code of HIDn.
I first tried to copy it to my own code and set breakpoints, but it gives compilation errors.
I then tried to recompile vanilla HIDn, but the errors persistet:
nspire-gcc -Os -Wall -W -marm -c ums.c
ums.c:33:24: error: field ‘sc_ibuf’ has incomplete type
  struct s_usb_pipe_buf sc_ibuf;
                        ^~~~~~~
ums.c: In function ‘attach’:
ums.c:134:44: warning: passing argument 7 of ‘usbd_open_pipe_intr’ makes pointer from integer without a cast [-Wint-conversion]
                            &sc->sc_ibuf, sc->sc_isize, ums_intr,
                                          ~~^~~~~~~~~~
In file included from /mnt/c/Users/usertemp/Desktop/TI/Ndless/ndless-sdk/bin/../include/os.h:30,
                 from ums.c:1:
/mnt/c/Users/usertemp/Desktop/TI/Ndless/ndless-sdk/bin/../include/syscall-decls.h:189:149: note: expected ‘uint32_t *’ {aka ‘long unsigned int *’} but argument is of type ‘int’
 erface_handle p1, uint8_t p2, uint8_t p3, usbd_pipe_handle *p4, usbd_private_handle p5, void *p6, uint32_t *p8, usbd_callback p9, int p10);
                                                                                                   ~~~~~~~~~~^~

ums.c: In function ‘ums_register’:
ums.c:158:2: warning: implicit declaration of function ‘nl_relocdata’; did you mean ‘e_nl_relocdatab’? [-Wimplicit-function-declaration]
  nl_relocdata((unsigned*)methods, sizeof(methods)/sizeof(methods[0]) - 1);
  ^~~~~~~~~~~~
  e_nl_relocdatab
make: *** [Makefile:24: ums.o] Error 1

I found the code on the nspiretools-history github: https://github.com/ndless-nspire/nsptools-history/tree/master/hidn/trunk
It's also on TI-Planet: https://tiplanet.org/forum/archives_voir.php?id=12928

Maybe the usb api in the ndless-sdk got changed, because the last changes to HIDn on github are 7 years old.
It seems as if nl_relocdata and struct s_usb_pipe_buf got removed.
The binary version works on my cx cas, so it's still possible to write usb drivers.
Also I'm using Windows Subsystem for Linux with debian to compile.
If anyone knows how to fix this, I'd be happy.
(this is my first post and I'm not a native speaker, please forgive me if I make spelling mistakes)

Pages: [1]