Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Feature Request - add "remote" member to the CanMsg class to denote Remote Transfer Request (RTR) frames

Abierto
#230 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
cpp
Área
embedded-iot

Línea de trabajo

Comienza con CanMsg.h para rastrear los constructores, el comportamiento de copia y la salida de printTo; después, inspecciona R7FA4M1_CAN.cpp y el manejo de can_frame_t por parte de onCanCallback. Comprueba si los otros archivos CAN de Renesas de 32 bits necesitan el mismo tratamiento. Se considera terminado cuando el estado remoto se conserva para los mensajes creados y recibidos sin romper las rutas de construcción existentes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

The CAN specification reserves a bit in the arbitration header to signal if the frame is a Remote Transfer Request (RTR) frame or a normal Data frame. This is the bit that follows the 11 identifier bits in the standard header, or the 18 bits of the second part of the identifier in an extended frame.

This is useful for system that use RTR (yes I know this is frowned on by some in the CAN community, see linked doc). However systems exist that require this support so we should enable the Uno R4 to detect if a frame has been sent with the RTR bit.

Given that the flag is already detected by the underlying FSP and the type appears in the "can_frame_t" CAN data frame struct, there is a relatively simple enhancement which I will float here.

The first part is to add it as a data member to the CanMsg class (in CanMsg.h)

  uint32_t id;
  uint8_t  data_length;
  uint8_t  data[MAX_DATA_LENGTH];
  bool     remote;  // == new member ==

and then add it to the constructors as an optional argument

class CanMsg : public Printable
// snip
  CanMsg(uint32_t const can_id, uint8_t const can_data_len, uint8_t const * can_data_ptr, bool const remote_frame_type = false)
  : id{can_id}
  , data_length{min(can_data_len, MAX_DATA_LENGTH)}
  , data{0}
  , remote{remote_frame_type}  
  {
//snip

(It would also need to be copied across in the copy constructor and probably useful to emit it in the printTo function.)
This now makes it available, however it is always set to false so the msg will default as a data frame unless the flag is set when the object is created.
For incoming messages in the R4 Uno this occurs in the R7FA4M1_CAN.cpp file

void R7FA4M1_CAN::onCanCallback(can_callback_args_t * p_args)
{
  switch (p_args->event)
  {
    case CAN_EVENT_TX_COMPLETE: break;
    case CAN_EVENT_RX_COMPLETE: // Currently driver don't support this. This is unreachable code for now.
    {
      /* Extract the received CAN message. */
      CanMsg const msg
      (
        (p_args->frame.id_mode == CAN_ID_MODE_STANDARD) ? CanStandardId(p_args->frame.id) : CanExtendedId(p_args->frame.id),
        p_args->frame.data_length_code,
        p_args->frame.data,
        (p_args->frame.type == CAN_FRAME_TYPE_REMOTE) // == new argument ==
      );
      /* Store the received CAN message in the receive buffer. */
      _can_rx_buf.enqueue(msg);
    }
//snip

I have not considered whether this would also require a change to files related to other 32 bit Renases chips (most likely yes).
However it appears to be largely backwards compatible as it does not affect the id (the other option was to use bit 30 if the id).

So, looking for some feedback before I do any further work and potentially provide a PR.

/-------------------
https://copperhilltech.com/content/CiA%20802%20AN%20V1.0%20CANopen%20CAN%20remote%20frames%20%E2%80%93%20Avoiding%20of%20usage.pdf

Lenguaje dominante
C++
Estrellas
306
Forks
150
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de arduino/ArduinoCore-API

Todos los issues de arduino/ArduinoCore-API

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.